Changeset 33219

Show
Ignore:
Timestamp:
05/10/09 20:05:17 (4 years ago)
Author:
dankogai
Message:

URI::Amazon::APA - URI to access Amazon Product Advertising API

Location:
lang/perl/URI-Amazon-APA/trunk
Files:
2 removed
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/URI-Amazon-APA/trunk/MANIFEST

    r33218 r33219  
    66t/00-load.t 
    77t/01-basic.t 
    8 t/pod-coverage.t 
    98t/pod.t 
  • lang/perl/URI-Amazon-APA/trunk/README

    r33214 r33219  
    1 URI-Amazon-APA 
     1NAME 
     2    URI::Amazon::APA - URI to access Amazon Product Advertising API 
    23 
    3 The README is used to introduce the module and provide instructions on 
    4 how to install the module, any machine dependencies it may have (for 
    5 example C compilers and installed libraries) and any other information 
    6 that should be provided before the module is installed. 
     4VERSION 
     5    $Id: README,v 0.1 2009/05/10 11:04:33 dankogai Exp dankogai $ 
    76 
    8 A README file is required for CPAN modules since CPAN extracts the README 
    9 file from a module distribution so that people browsing the archive 
    10 can use it to get an idea of the module's uses. It is usually a good idea 
    11 to provide version information here so that people can decide whether 
    12 fixes for the module are worth downloading. 
     7SYNOPSIS 
     8      # self-explanatory 
     9      use strict; 
     10      use warnings; 
     11      use URI::Amazon::APA; 
     12      use LWP::UserAgent; 
     13      use XML::Simple; 
     14      use YAML::Syck; 
    1315 
     16      use URI::Amazon::APA; # instead of URI 
     17      my $u = URI::Amazon::APA->new('http://webservices.amazon.com/onca/xml'); 
     18      $u->query_form( 
     19        Service     => 'AWSECommerceService', 
     20        Operation   => 'ItemSearch', 
     21        Title       => shift || 'Perl', 
     22        SearchIndex => 'Books', 
     23      ); 
     24      $u->sign( 
     25        key    => $public_key, 
     26        secret => $private_key, 
     27      ); 
    1428 
    15 INSTALLATION 
     29      my $ua = LWP::UserAgent->new; 
     30      my $r  = $ua->get($u); 
     31      if ( $r->is_success ) { 
     32        print YAML::Syck::Dump( XMLin( $r->content ) ); 
     33      } 
     34      else { 
     35        print $r->status_line, $r->as_string; 
     36      } 
    1637 
    17 To install this module, run the following commands: 
     38EXPORT 
     39    None. 
    1840 
    19         perl Makefile.PL 
    20         make 
    21         make test 
    22         make install 
     41METHODS 
     42    This adds the following methods to URI object 
    2343 
    24 SUPPORT AND DOCUMENTATION 
     44  sign 
     45    Sings the URI accordingly to the Amazon Product Advertising API. 
    2546 
    26 After installing, you can find documentation for this module with the 
    27 perldoc command. 
     47      $u->sign( 
     48        key    => $public_key, 
     49        secret => $private_key, 
     50      ); 
    2851 
    29     perldoc URI::Amazon::APA 
     52  signature 
     53    Checks the signature within the URI; 
    3054 
    31 You can also look for information at: 
     55      print "The signature is " : $u->signature; 
    3256 
    33     RT, CPAN's request tracker 
    34         http://rt.cpan.org/NoAuth/Bugs.html?Dist=URI-Amazon-APA 
     57AUTHOR 
     58    Dan Kogai, "<dankogai at dan.co.jp>" 
    3559 
    36     AnnoCPAN, Annotated CPAN documentation 
    37         http://annocpan.org/dist/URI-Amazon-APA 
     60BUGS 
     61    Please report any bugs or feature requests to "bug-uri-amazon-apa at 
     62    rt.cpan.org", or through the web interface at 
     63    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=URI-Amazon-APA>. I will 
     64    be notified, and then you'll automatically be notified of progress on 
     65    your bug as I make changes. 
    3866 
    39     CPAN Ratings 
    40         http://cpanratings.perl.org/d/URI-Amazon-APA 
     67SUPPORT 
     68    You can find documentation for this module with the perldoc command. 
    4169 
    42     Search CPAN 
    43         http://search.cpan.org/dist/URI-Amazon-APA/ 
     70        perldoc URI::Amazon::APA 
    4471 
     72    You can also look for information at: 
    4573 
    46 COPYRIGHT AND LICENCE 
     74    *   RT: CPAN's request tracker 
    4775 
    48 Copyright (C) 2009 Dan Kogai 
     76        <http://rt.cpan.org/NoAuth/Bugs.html?Dist=URI-Amazon-APA> 
    4977 
    50 This program is free software; you can redistribute it and/or modify it 
    51 under the same terms as Perl itself. 
     78    *   AnnoCPAN: Annotated CPAN documentation 
    5279 
     80        <http://annocpan.org/dist/URI-Amazon-APA> 
     81 
     82    *   CPAN Ratings 
     83 
     84        <http://cpanratings.perl.org/d/URI-Amazon-APA> 
     85 
     86    *   Search CPAN 
     87 
     88        <http://search.cpan.org/dist/URI-Amazon-APA/> 
     89 
     90ACKNOWLEDGEMENTS 
     91    <http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.h 
     92    tml?rest-signature.html> 
     93 
     94COPYRIGHT & LICENSE 
     95    Copyright 2009 Dan Kogai, all rights reserved. 
     96 
     97    This program is free software; you can redistribute it and/or modify it 
     98    under the same terms as Perl itself. 
     99 
  • lang/perl/URI-Amazon-APA/trunk/lib/URI/Amazon/APA.pm

    r33218 r33219  
    22use warnings; 
    33use strict; 
    4 our $VERSION = sprintf "%d.%02d", q$Revision: 0.2 $ =~ /(\d+)/g; 
     4our $VERSION = sprintf "%d.%02d", q$Revision: 0.1 $ =~ /(\d+)/g; 
    55use Carp; 
    66use POSIX qw(strftime); 
     
    4242} 
    4343 
    44 if ( $0 eq __FILE__ ) { 
    45 } 
    46  
    47441; # End of URI::Amazon::APA 
    4845 
     
    5148URI::Amazon::APA - URI to access Amazon Product Advertising API 
    5249 
    53  
    5450=head1 VERSION 
    5551 
    56 $Id$ 
     52$Id: APA.pm,v 0.1 2009/05/10 11:01:30 dankogai Exp dankogai $ 
    5753 
    5854=head1 SYNOPSIS 
    5955 
    60 Quick summary of what the module does. 
     56  # self-explanatory 
     57  use strict; 
     58  use warnings; 
     59  use URI::Amazon::APA; 
     60  use LWP::UserAgent; 
     61  use XML::Simple; 
     62  use YAML::Syck; 
    6163 
    62 Perhaps a little code snippet. 
     64  use URI::Amazon::APA; # instead of URI 
     65  my $u = URI::Amazon::APA->new('http://webservices.amazon.com/onca/xml'); 
     66  $u->query_form( 
     67    Service     => 'AWSECommerceService', 
     68    Operation   => 'ItemSearch', 
     69    Title       => shift || 'Perl', 
     70    SearchIndex => 'Books', 
     71  ); 
     72  $u->sign( 
     73    key    => $public_key, 
     74    secret => $private_key, 
     75  ); 
    6376 
    64     use URI::Amazon::APA; 
    65  
    66     my $foo = URI::Amazon::APA->new(); 
    67     ... 
     77  my $ua = LWP::UserAgent->new; 
     78  my $r  = $ua->get($u); 
     79  if ( $r->is_success ) { 
     80    print YAML::Syck::Dump( XMLin( $r->content ) ); 
     81  } 
     82  else { 
     83    print $r->status_line, $r->as_string; 
     84  } 
    6885 
    6986=head1 EXPORT 
    7087 
    71 A list of functions that can be exported.  You can delete this section 
    72 if you don't export anything, such as for a purely object-oriented module. 
     88None. 
    7389 
    74 =head1 FUNCTIONS 
     90=head1 METHODS 
    7591 
    76 =head2 function1 
     92This adds the following methods to L<URI> object 
     93 
     94=head2 sign 
     95 
     96Sings the URI accordingly to the Amazon Product Advertising API. 
     97 
     98  $u->sign( 
     99    key    => $public_key, 
     100    secret => $private_key, 
     101  ); 
     102 
     103=head2 signature 
     104 
     105Checks the signature within the URI; 
     106 
     107  print "The signature is " : $u->signature; 
    77108 
    78109=head1 AUTHOR 
     
    115146=back 
    116147 
    117  
    118148=head1 ACKNOWLEDGEMENTS 
    119149 
     150L<http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?rest-signature.html> 
    120151 
    121152=head1 COPYRIGHT & LICENSE 
  • lang/perl/URI-Amazon-APA/trunk/t/01-basic.t

    r33218 r33219  
    1717    secret => '1234567890', 
    1818); 
    19 warn $u; 
     19#warn $u; 
    2020#is ($u->signature, 'Nace/U3Az4OhN7tISqgs1vdLBHBEijWcBeCqL5xN9xg='); 
    2121is ($u->signature, 'Nace+U3Az4OhN7tISqgs1vdLBHBEijWcBeCqL5xN9xg=');