| 1 | # Copyrights 2013-2019 by [Mark Overmeer <markov@cpan.org>]. | ||
| 2 | # For other contributors see ChangeLog. | ||
| 3 | # See the manual pages for details on the licensing terms. | ||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||
| 5 | # This code is part of distribution Net-OAuth2. Meta-POD processed | ||
| 6 | # with OODoc into POD and HTML manual-pages. See README.md | ||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||
| 8 | |||
| 9 | package Net::OAuth2::Client; | ||
| 10 | use vars '$VERSION'; | ||
| 11 | $VERSION = '0.66'; | ||
| 12 | |||
| 13 | use warnings; | ||
| 14 | use strict; | ||
| 15 | |||
| 16 | use LWP::UserAgent (); | ||
| 17 | use URI (); | ||
| 18 | |||
| 19 | use Net::OAuth2::Profile::WebServer; | ||
| 20 | use Net::OAuth2::Profile::Password; | ||
| 21 | |||
| 22 | |||
| 23 | sub new($$@) | ||
| 24 | { my ($class, $id, $secret, %opts) = @_; | ||
| 25 | |||
| 26 | $opts{client_id} = $id; | ||
| 27 | $opts{client_secret} = $secret; | ||
| 28 | |||
| 29 | # auto-shared user-agent | ||
| 30 | $opts{user_agent} ||= LWP::UserAgent->new; | ||
| 31 | |||
| 32 | bless \%opts, $class; | ||
| 33 | } | ||
| 34 | |||
| 35 | #---------------- | ||
| 36 | |||
| 37 | sub id() {shift->{NOC_id}} | ||
| 38 | sub secret() {shift->{NOC_secret}} | ||
| 39 | sub user_agent() {shift->{NOC_agent}} | ||
| 40 | |||
| 41 | #---------------- | ||
| 42 | |||
| 43 | sub web_server(@) | ||
| 44 | { my $self = shift; | ||
| 45 | Net::OAuth2::Profile::WebServer->new(%$self, @_); | ||
| 46 | } | ||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | sub password(@) | ||
| 51 | { my $self = shift; | ||
| 52 | Net::OAuth2::Profile::Password->new(%$self, @_); | ||
| 53 | } | ||
| 54 | |||
| 55 | 1; |