Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for Perl extension Net::Google::DataAPI

0.2806 Thu Oct 25 11:49:00 2018
- Convert from Any::Moose to Moose, remove trailing spaces.

0.2805 Sat Jun 28 17:30:00 2014
- allow state parameter for Net::Google::DataAPI::Auth::OAuth2

Expand Down Expand Up @@ -69,7 +72,7 @@ Revision history for Perl extension Net::Google::DataAPI

0.19 Mon Jun 07 12:27:00 2010

- make 'lazy_build' the content property of Role::HasContent
- make 'lazy_build' the content property of Role::HasContent

0.18 Sun May 16 10:08:00 2010

Expand Down
6 changes: 1 addition & 5 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ requires 'LWP::Protocol::https';
requires 'URI';
requires 'Lingua::EN::Inflect::Number';
requires 'Text::Glob';
requires_any_moose(
prefer => 'Mouse',
moose => '0.56',
mouse => '0.51',
);
requires 'Moose';

tests_recursive;
author_tests 'xt';
Expand Down
2 changes: 1 addition & 1 deletion eg/login.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ get '/callback' => sub {
my ($c) = @_;
if ($c->req->param('error')) {
return $c->render('error.tt');
}
}
my $code = $c->req->param('code')
or return $c->redirect($c->uri_for('/'));
my $oauth2 = oauth2();
Expand Down
2 changes: 1 addition & 1 deletion eg/spreadsheets.psgi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ get '/callback' => sub {
my ($c) = @_;
if ($c->req->param('error')) {
return $c->render('error.tt');
}
}
my $code = $c->req->param('code')
or return $c->redirect($c->uri_for('/'));
my $state = $c->session->get('state')
Expand Down
38 changes: 19 additions & 19 deletions lib/Net/Google/DataAPI.pm
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package Net::Google::DataAPI;
use 5.008001;
use Any::Moose;
use Any::Moose '::Exporter';
use Moose;
use Moose::Exporter;
use Carp;
use Lingua::EN::Inflect::Number qw(to_PL);
use XML::Atom;
our $VERSION = '0.2805';
use Class::Load ':all';
our $VERSION = '0.2806';

any_moose('::Exporter')->setup_import_methods(
Moose::Exporter->setup_import_methods(
as_is => ['feedurl', 'entry_has'],
);

Expand All @@ -16,7 +17,7 @@ sub feedurl {

my $class = caller;

my $entry_class = delete $args{entry_class}
my $entry_class = delete $args{entry_class}
or confess 'entry_class not specified';

my $can_add = delete $args{can_add};
Expand All @@ -41,7 +42,7 @@ sub feedurl {

my $attr_name = "${name}_feedurl";

my $class_meta = any_moose('::Meta::Class')->initialize($class);
my $class_meta = Moose::Meta::Class->initialize($class);
$class_meta->add_attribute(
$attr_name => (
isa => 'Str',
Expand All @@ -57,13 +58,13 @@ sub feedurl {
$class_meta->add_method(
"_build_$attr_name" => sub {
my $self = shift;
return $rel ?
return $rel ?
[
map { $_->href }
grep { $_->rel eq $rel }
$self->atom->link
]->[0] :
$as_content_src ?
$as_content_src ?
$self->atom->content->elem->getAttribute('src') :
$from_atom ?
$from_atom->($self, $self->atom) : $default;
Expand All @@ -76,9 +77,9 @@ sub feedurl {
"add_$name" => sub {
my ($self, $args) = @_;
$self->$attr_name or confess "$attr_name is not set";
Any::Moose::load_class($entry_class);
load_class($entry_class);
$args = $arg_builder->($self, $args);
my %parent =
my %parent =
$self->can('sync') ?
( container => $self ) : ( service => $self );
my $entry = $entry_class->new(
Expand All @@ -105,7 +106,7 @@ sub feedurl {
$cond;
} else {
$self->$attr_name or confess "$attr_name is not set";
Any::Moose::load_class($entry_class);
load_class($entry_class);
$self->can("${name}_feed")->($self, $cond);
}
};
Expand Down Expand Up @@ -139,8 +140,8 @@ sub entry_has {
my ($name, %args) = @_;

my $class = caller;
my $class_meta = any_moose('::Meta::Class')->initialize($class);
$class_meta->does_role('Net::Google::DataAPI::Role::Entry')
my $class_meta = Moose::Meta::Class->initialize($class);
$class_meta->does_role('Net::Google::DataAPI::Role::Entry')
or confess 'Net::Google::DataAPI::Role::Entry required to use entry_has';

my $tagname = delete $args{tagname};
Expand Down Expand Up @@ -205,8 +206,7 @@ sub entry_has {
}

__PACKAGE__->meta->make_immutable;
no Any::Moose;
no Any::Moose '::Exporter';
no Moose;

1;
__END__
Expand All @@ -218,7 +218,7 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google
=head1 SYNOPSIS

package MyService;
use Any::Moose;
use Moose;
use Net::Google::DataAPI;

with 'Net::Google::DataAPI::Role::Service';
Expand Down Expand Up @@ -252,7 +252,7 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google
1;

package MyEntry;
use Any::Moose;
use Moose;
use Net::Google::DataAPI;
with 'Net::Google::DataAPI::Role::Entry';

Expand All @@ -269,13 +269,13 @@ Net::Google::DataAPI - Base implementations for modules to negotiate with Google

=head1 DESCRIPTION

Net::Google::DataAPI is base implementations for modules to negotiate with Google Data APIs.
Net::Google::DataAPI is base implementations for modules to negotiate with Google Data APIs.

=head1 METHODS

=head2 feedurl

define a feed url.
define a feed url.

=head2 entry_has

Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Google/DataAPI/Auth/AuthSub.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Auth::AuthSub;
use Any::Moose;
use Moose;
with 'Net::Google::DataAPI::Role::Auth';
use Net::Google::AuthSub;
use URI;
Expand All @@ -20,6 +20,6 @@ sub sign_request {

__PACKAGE__->meta->make_immutable;

no Any::Moose;
no Moose;

1;
4 changes: 2 additions & 2 deletions lib/Net/Google/DataAPI/Auth/ClientLogin/Multiple.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Auth::ClientLogin::Multiple;
use Any::Moose;
use Moose;
use Net::Google::AuthSub;
use Text::Glob;
with 'Net::Google::DataAPI::Role::Auth';
Expand Down Expand Up @@ -47,7 +47,7 @@ sub _get_auth_params {

__PACKAGE__->meta->make_immutable;

no Any::Moose;
no Moose;

1;
__END__
Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Google/DataAPI/Auth/Null.pm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package Net::Google::DataAPI::Auth::Null;
use Any::Moose;
use Moose;
with 'Net::Google::DataAPI::Role::Auth';
our $VERSION = '0.02';


sub sign_request {$_[1]};

__PACKAGE__->meta->make_immutable;
no Any::Moose;
no Moose;

1;
26 changes: 13 additions & 13 deletions lib/Net/Google/DataAPI/Auth/OAuth.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Auth::OAuth;
use Any::Moose;
use Moose;
use Net::Google::DataAPI::Types;
with 'Net::Google::DataAPI::Role::Auth';
use Digest::SHA1;
Expand All @@ -12,17 +12,17 @@ our $VERSION = '0.05';
has [qw(consumer_key consumer_secret)] => ( is => 'ro', isa => 'Str', required => 1 );

for my $attr (qw(
request_token
request_token
request_token_secret
access_token
access_token
access_token_secret
)) {
has $attr => (
is => 'rw',
isa => 'Str',
clearer => "clear_$attr",
predicate => "has_$attr"
);
)) {
has $attr => (
is => 'rw',
isa => 'Str',
clearer => "clear_$attr",
predicate => "has_$attr"
);
}

has scope => ( is => 'ro', isa => 'ArrayRef[Str]', required => 1, auto_deref => 1 );
Expand All @@ -32,7 +32,7 @@ has authorize_token_hd => ( is => 'ro', isa => 'Str', default => 'default' );
has authorize_token_hl => ( is => 'ro', isa => 'Str', default => 'en' );
has mobile => ( is => 'ro', isa => 'Bool', default => 0 );
has ua => ( is => 'ro', isa => 'LWP::UserAgent', required => 1, lazy_build => 1 );
sub _build_ua {
sub _build_ua {
LWP::UserAgent->new( max_redirect => 0 );
}

Expand All @@ -50,7 +50,7 @@ sub get_request_token {
my ($self, $args) = @_;
my $res = $self->_oauth_request(
'request token',
{
{
request_url => $self->get_request_token_url,
extra_params => {
scope => join(' ', $self->scope),
Expand Down Expand Up @@ -146,7 +146,7 @@ sub sign_request {
}

__PACKAGE__->meta->make_immutable;
no Any::Moose;
no Moose;

1;
__END__
Expand Down
10 changes: 5 additions & 5 deletions lib/Net/Google/DataAPI/Auth/OAuth2.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Auth::OAuth2;
use Any::Moose;
use Moose;
use Net::Google::DataAPI::Types;
with 'Net::Google::DataAPI::Role::Auth';
use Net::OAuth2::Client;
Expand All @@ -11,7 +11,7 @@ has [qw(client_id client_secret)] => (is => 'ro', isa => 'Str', required => 1);
has redirect_uri => (is => 'ro', isa => 'Str', default => 'urn:ietf:wg:oauth:2.0:oob');
has scope => (is => 'ro', isa => 'ArrayRef[Str]', required => 1, auto_deref => 1,
default => sub {[
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
]},
);
Expand All @@ -35,7 +35,7 @@ sub _build_oauth2_client {
has oauth2_webserver => (is => 'ro', isa => 'Net::OAuth2::Profile::WebServer', required => 1, lazy_build => 1);
sub _build_oauth2_webserver {
my $self = shift;
$self->oauth2_client->web_server(
$self->oauth2_client->web_server(
redirect_uri => $self->redirect_uri,
state => $self->state,
);
Expand Down Expand Up @@ -89,7 +89,7 @@ sub sign_request {
}

__PACKAGE__->meta->make_immutable;
no Any::Moose;
no Moose;

1;
__END__
Expand Down Expand Up @@ -180,7 +180,7 @@ Nobuo Danjou E<lt>danjou@soffritto.orgE<gt>

L<Net::OAuth2>

L<https://developers.google.com/accounts/docs/OAuth2>
L<https://developers.google.com/accounts/docs/OAuth2>

you can see sample implementations for oauth2 client both as installed and web app in the eg directory of this distribution.

Expand Down
4 changes: 2 additions & 2 deletions lib/Net/Google/DataAPI/Role/Auth.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package Net::Google::DataAPI::Role::Auth;
use Any::Moose '::Role';
use Moose::Role;
requires 'sign_request';
no Any::Moose '::Role';
no Moose::Role;
our $VERSION = '0.02';

1;
6 changes: 3 additions & 3 deletions lib/Net/Google/DataAPI/Role/Entry.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Role::Entry;
use Any::Moose '::Role';
use Moose::Role;
use Carp;
use XML::Atom;
use XML::Atom::Entry;
Expand Down Expand Up @@ -133,7 +133,7 @@ sub delete {
return $res->is_success;
}

no Any::Moose '::Role';
no Moose::Role;

1;

Expand All @@ -148,7 +148,7 @@ Net::Google::DataAPI::Role::Entry - represents entry of Google Data API
=head1 SYNOPSIS

package MyEntry;
use Any::Moose;
use Moose;
use Net::Google::DataAPI;
with 'Net::Google::DataAPI::Role::Entry';

Expand Down
6 changes: 3 additions & 3 deletions lib/Net/Google/DataAPI/Role/HasContent.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Google::DataAPI::Role::HasContent;
use Any::Moose '::Role';
use Moose::Role;
our $VERSION='0.03';

requires 'update';
Expand Down Expand Up @@ -28,7 +28,7 @@ sub param {
}
}

no Any::Moose '::Role';
no Moose::Role;

1;

Expand All @@ -43,7 +43,7 @@ Net::Google::DataAPI::Role::HasContent - provides 'param' method to Entry
=head1 SYNOPSIS

package MyEntry;
use Any::Moose;
use Moose;
with qw(
Net::Google::DataAPI::Role::Entry
Net::Google::DataAPI::Role::HasContent
Expand Down
Loading