| 1 | package OAuthomatic::UserInteraction; | ||
| 2 | # ABSTRACT: Wrapping communication with user | ||
| 3 | |||
| 4 | |||
| 5 | 9 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 9 | ▶ | use OAuthomatic::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 9 | ▶ | use namespace::sweep; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | |||
| 10 | 9 | requires 'prompt_client_credentials'; | |
| 11 | |||
| 12 | |||
| 13 | 9 | requires 'visit_oauth_authorize_page'; | |
| 14 | |||
| 15 | |||
| 16 | 9 | requires 'prepare_to_work'; | |
| 17 | |||
| 18 | |||
| 19 | 9 | requires 'cleanup_after_work'; | |
| 20 | |||
| 21 | 9 | 1; | |
| 22 | |||
| 23 | __END__ | ||
| 24 | |||
| 25 | =pod | ||
| 26 | |||
| 27 | =encoding UTF-8 | ||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | OAuthomatic::UserInteraction - Wrapping communication with user | ||
| 32 | |||
| 33 | =head1 VERSION | ||
| 34 | |||
| 35 | version 0.01 | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Role defining methods related to communication with end user. | ||
| 40 | |||
| 41 | =head1 METHODS | ||
| 42 | |||
| 43 | =head2 prompt_client_credentials() => ClientCred(...) | ||
| 44 | |||
| 45 | Asks the user to visit appropriate remote page and provide application | ||
| 46 | (or developer) keys. Should return L<OAuthomatic::Types::ClientCred>. | ||
| 47 | |||
| 48 | Implementation can either prompt user interactively (on the terminal, | ||
| 49 | in browser, in GUI window...), hinting her or him which place to | ||
| 50 | visit, or have those values hardcoded/loaded from elsewhere. | ||
| 51 | |||
| 52 | Note that while methods below are (mostly) parameterless, this object | ||
| 53 | will work in context of specific site and application, and should | ||
| 54 | likely require information about those in the constructor. | ||
| 55 | |||
| 56 | See L<OAuthomatic::UserInteraction::ViaMicroWeb> and L<OAuthomatic::UserInteraction::ConsolePrompts> | ||
| 57 | for example implementations. | ||
| 58 | |||
| 59 | =head2 visit_oauth_authorize_page($app_auth_url) | ||
| 60 | |||
| 61 | Send user to the page of given url (which points to I<grant access to | ||
| 62 | application ...> page and already contains all necessary parameters). | ||
| 63 | |||
| 64 | =head2 prepare_to_work() | ||
| 65 | |||
| 66 | Prepare anything necessary to handle other calls. | ||
| 67 | |||
| 68 | =head2 cleanup_after_work() | ||
| 69 | |||
| 70 | Called once object is no longer needed, may cleanup whatever | ||
| 71 | prepare_to_work initialized or started. | ||
| 72 | |||
| 73 | =head1 AUTHOR | ||
| 74 | |||
| 75 | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> | ||
| 76 | |||
| 77 | =head1 COPYRIGHT AND LICENSE | ||
| 78 | |||
| 79 | This software is copyright (c) 2015 by Marcin Kasperski. | ||
| 80 | |||
| 81 | This is free software; you can redistribute it and/or modify it under | ||
| 82 | the same terms as the Perl 5 programming language system itself. | ||
| 83 | |||
| 84 | =cut | ||