diff options
Diffstat (limited to '')
-rw-r--r-- | lib/MooseX/Net/API/Role/Authentication.pm | 36 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/Deserialize.pm | 49 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/Format.pm | 44 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/Request.pm | 42 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/Serialization.pm | 46 | ||||
-rw-r--r-- | lib/MooseX/Net/API/Role/UserAgent.pm | 34 |
6 files changed, 201 insertions, 50 deletions
diff --git a/lib/MooseX/Net/API/Role/Authentication.pm b/lib/MooseX/Net/API/Role/Authentication.pm index 6c38641..0b6de69 100644 --- a/lib/MooseX/Net/API/Role/Authentication.pm +++ b/lib/MooseX/Net/API/Role/Authentication.pm @@ -45,3 +45,39 @@ after BUILDALL => sub { }; 1; +__END__ + +=head1 NAME + +MooseX::Net::API::Role::Authentication + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head2 ATTRIBUTES + +=over 4 + +=item B<api_password> + +=item B<api_username> + +=back + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2009, 2010 by Linkfluence + +http://linkfluence.net + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/Net/API/Role/Deserialize.pm b/lib/MooseX/Net/API/Role/Deserialize.pm deleted file mode 100644 index cf69087..0000000 --- a/lib/MooseX/Net/API/Role/Deserialize.pm +++ /dev/null @@ -1,49 +0,0 @@ -package MooseX::Net::API::Role::Deserialize; - -use Moose::Role; -use JSON::XS; -use YAML::Syck; -use XML::Simple; -use Try::Tiny; - -my $reverse_content_type = { - 'application/json' => 'json', - 'application/x-yaml' => 'yaml', - 'text/xml' => 'xml', - 'application/xml' => 'xml', -}; - -sub _from_json { - return decode_json( $_[1] ); -} - -sub _from_yaml { - return Load $_[1]; -} - -sub _from_xml { - my $xml = XML::Simple->new( ForceArray => 0 ); - $xml->XMLin( $_[1] ); -} - -sub _do_deserialization { - my ( $caller, $raw_content, @content_types ) = @_; - - my $content; - foreach my $deserializer (@content_types) { - my $method; - if ( $reverse_content_type->{$deserializer} ) { - $method = '_from_' . $reverse_content_type->{$deserializer}; - } - else { - $method = '_from_' . $deserializer; - } - next if ( !$caller->meta->find_method_by_name($method) ); - try { - $content = $caller->$method($raw_content); - }; - return $content if $content; - } -} - -1; diff --git a/lib/MooseX/Net/API/Role/Format.pm b/lib/MooseX/Net/API/Role/Format.pm index 32dbc98..e766161 100644 --- a/lib/MooseX/Net/API/Role/Format.pm +++ b/lib/MooseX/Net/API/Role/Format.pm @@ -39,3 +39,47 @@ has api_format_mode => ( ); 1; +__END__ + +=head1 NAME + +MooseX::Net::API::Role::Format + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head2 METHODS + +=over 4 + +=item B<content_type> + +=back + +=head2 ATTRIBUTES + +=over 4 + +=item B<api_format> + +=item B<api_format_mode> + +=back + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2009, 2010 by Linkfluence + +http://linkfluence.net + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/Net/API/Role/Request.pm b/lib/MooseX/Net/API/Role/Request.pm index eabb32d..214411c 100644 --- a/lib/MooseX/Net/API/Role/Request.pm +++ b/lib/MooseX/Net/API/Role/Request.pm @@ -50,3 +50,45 @@ sub http_request { } 1; +__END__ + +=head1 NAME + +MooseX::Net::API::Role::Request + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head2 METHODS + +=over 4 + +=item B<http_request> + +=back + +=head2 ATTRIBUTES + +=over 4 + +=item B<api_base_url> + +=back + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2009, 2010 by Linkfluence + +http://linkfluence.net + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/Net/API/Role/Serialization.pm b/lib/MooseX/Net/API/Role/Serialization.pm index b813b03..d4feb56 100644 --- a/lib/MooseX/Net/API/Role/Serialization.pm +++ b/lib/MooseX/Net/API/Role/Serialization.pm @@ -70,3 +70,49 @@ sub _load_serializer { } 1; +__END__ + +=head1 NAME + +MooseX::Net::API::Role::Serialization + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head2 ATTRIBUTES + +=over 4 + +=item B<serializers> + +=back + +=head2 METHODS + +=over 4 + +=item B<get_content> + +=item B<serialize> + +=item B<deserialize> + +=back + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2009, 2010 by Linkfluence + +http://linkfluence.net + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut diff --git a/lib/MooseX/Net/API/Role/UserAgent.pm b/lib/MooseX/Net/API/Role/UserAgent.pm index 0c11732..c3a1d5b 100644 --- a/lib/MooseX/Net/API/Role/UserAgent.pm +++ b/lib/MooseX/Net/API/Role/UserAgent.pm @@ -20,5 +20,37 @@ has api_useragent => ( ); 1; - __END__ + +=head1 NAME + +MooseX::Net::API::Role::UseAgent + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head2 ATTRIBUTES + +=over 4 + +=item B<api_useragent> + +=back + +=head1 AUTHOR + +franck cuny E<lt>franck@lumberjaph.netE<gt> + +=head1 SEE ALSO + +=head1 LICENSE + +Copyright 2009, 2010 by Linkfluence + +http://linkfluence.net + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut |