kernow-ruby-aaws 0.5.4 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,129 +1,145 @@
1
- = Ruby/AWS - A Ruby interface to the Amazon Associates Web Services API.
2
-
3
- == Introduction
4
-
5
- Ruby/AWS is a Ruby language library that allows programmatic access to
6
- the popular Amazon Web sites via the AWS v4 API. It is the successor to the
7
- now obsolete Ruby/Amazon.
8
-
9
- In addition to the original
10
- amazon.com[http://www.amazon.com/exec/obidos/redirect-home/calibanorg-20]
11
- site, the local sites
12
- amazon.co.uk[http://www.amazon.co.uk/exec/obidos/redirect-home/caliban-21],
13
- amazon.de[http://www.amazon.de/exec/obidos/redirect-home/calibanorg0a-21],
14
- amazon.fr[http://www.amazon.fr/exec/obidos/redirect-home/caliban08-21],
15
- amazon.ca[http://www.amazon.ca/exec/obidos/redirect-home/caliban-20] and
16
- amazon.co.jp[http://www.amazon.co.jp/exec/obidos/redirect-home/calibanorg-20]
17
- are also supported.
18
-
19
- Although the library is still in development, the AWS v4 API is now more or
20
- less fully supported, with only tiny gaps in the functionality of some
21
- operations.
22
-
23
- The following operations are supported:
24
-
25
- BrowseNodeLookup
26
- CustomerContentLookup
27
- CustomerContentSearch
28
- Help
29
- ItemLookup
30
- ItemSearch
31
- ListLookup
32
- ListSearch
33
- SellerListingLookup
34
- SellerListingSearch
35
- SellerLookup
36
- SimilarityLookup
37
- TagLookup
38
- TransactionLookup
39
-
40
- Remote shopping-carts are also supported. This adds the following operations:
41
-
42
- CartCreate
43
- CartAdd
44
- CartModify
45
- CartClear
46
- CartGet
47
-
48
- In addition, multiple operations and batch requests are also supported.
49
-
50
- Ruby/AWS also offers advanced features not directly available in the AWS
51
- API, such as the ability to retrieve *all* results pages for a particular
52
- search, rather than having to manually deal with AWS responses of 10 results
53
- per page.
54
-
55
- You can also retrieve product images and optionally overlay them with
56
- percentage discount icons.
57
-
58
- Another advanced feature is the ability to cache responses returned by AWS.
59
- If the cache is used (as it is by default), the results of each unique
60
- query will be cached and used for 24 hours. The cache can be manually
61
- flushed of all or just the expired entries.
62
-
63
- One other useful advanced feature is the ability to determine the
64
- appropriate Amazon locale for a given client, based on its IP address or
65
- host name. This allows you to perform AWS operations using the correct
66
- geographical Amazon site for any given client. German and Austrian clients
67
- can be made to interact with amazon.de, British and Irish clients with
68
- amazon.co.uk, etc.
69
-
70
-
71
- == Installation
72
-
73
- Please see the +INSTALL+ file supplied with the software for details of how
74
- to install Ruby/AWS. You can choose between an installation script and a
75
- RubyGems[http://www.rubygems.org/] installation.
76
-
77
- Note, however, if choosing the gem installation, that whilst Ruby/AWS's
78
- RubyForge UNIX name is now ruby-aaws. The ruby-aws name was taken by
79
- {another project}[http://rubyforge.org/projects/ruby-aws/] and this clash
80
- prevented remote installation of the Ruby/AWS gem.
81
-
82
-
83
- == Prerequisites
84
-
85
- Before you can use this library, you need to obtain an Amazon Web Services
86
- {access key
87
- ID}[https://aws-portal.amazon.com/gp/aws/developer/registration/index.html].
88
-
89
- You should also apply for an {Associates
90
- account}[http://docs.amazonwebservices.com/AWSECommerceService/2008-04-07/GSG/BecominganAssociate.html],
91
- although this isn't strictly necessary. If you do not explicitly provide an
92
- Associates tag in your calls through Ruby/AWS, the tag of the Ruby/AWS
93
- author will be used by default.
94
-
95
-
96
- == See Also
97
-
98
- Ultimately, the way to get the most from this library is to read the AWS
99
- documentation to get a feel for what is possible, and then experiment with
100
- this library to see how the AWS calls are mapped into the Ruby world. You
101
- should also review this library's
102
- RDoc[http://www.ruby-doc.org/core/classes/RDoc.html]
103
- documentation[http://www.caliban.org/ruby/ruby-aws/] as well as the
104
- plain-text +README+ file that came with the archive.
105
-
106
- Additionally, there's a
107
- {mailing-list}[http://www.caliban.org/mailman/listinfo/ruby-aws] available,
108
- where you can discuss all Ruby/AWS-related subjects and issues.
109
-
110
- Please see the Amazon Web Services
111
- documentation[http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=5]
112
- for definitive information on the capabilities and inner workings of the AWS
113
- API.
114
-
115
-
116
- == Download
117
-
118
- Version 0.4.4
119
- === {gzip'ed tar archive}[http://www.caliban.org/files/ruby/ruby-aws-0.4.4.tar.gz]
120
- === {Ruby Gem}[http://www.caliban.org/files/ruby/ruby-aaws-0.4.4.gem]
121
- === {Fedora 9 RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-0.4.4-1.fc9.noarch.rpm]
122
- === {Fedora 9 doc RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-doc-0.4.4-1.fc9.noarch.rpm]
123
- === {Fedora 9 source RPM}[http://www.caliban.org/files/redhat/SRPMS/ruby-aws-0.4.4-1.fc9.src.rpm]
124
-
125
-
126
- ---
127
- Author:: Ian Macdonald <mailto:ian@caliban.org>
128
- Version:: 0.4.4
129
- Licence:: GPL[http://www.gnu.org/copyleft/gpl.html]
1
+ #--
2
+ # $Id: README.rdoc,v 1.25 2009/06/15 23:51:11 ianmacd Exp $
3
+ #++
4
+ #
5
+ #
6
+ # = Ruby/AWS - A Ruby interface to the Amazon Associates Web Services API.
7
+ #
8
+ # == Introduction
9
+ #
10
+ # Ruby/AWS is a Ruby language library that allows programmatic access to
11
+ # the popular Amazon Web sites via the AWS v4 API. It is the successor to the
12
+ # now obsolete Ruby/Amazon.
13
+ #
14
+ # In addition to the original
15
+ # amazon.com[http://www.amazon.com/exec/obidos/redirect-home/calibanorg-20]
16
+ # site, the local sites
17
+ # amazon.co.uk[http://www.amazon.co.uk/exec/obidos/redirect-home/caliban-21],
18
+ # amazon.de[http://www.amazon.de/exec/obidos/redirect-home/calibanorg0a-21],
19
+ # amazon.fr[http://www.amazon.fr/exec/obidos/redirect-home/caliban08-21],
20
+ # amazon.ca[http://www.amazon.ca/exec/obidos/redirect-home/caliban-20] and
21
+ # amazon.co.jp[http://www.amazon.co.jp/exec/obidos/redirect-home/calibanorg-20]
22
+ # are also supported.
23
+ #
24
+ # Although the library is still in development, the AWS v4 API is now more or
25
+ # less fully supported, with only tiny gaps in the functionality of some
26
+ # operations.
27
+ #
28
+ # The following operations are supported:
29
+ #
30
+ # BrowseNodeLookup
31
+ # CustomerContentLookup
32
+ # CustomerContentSearch
33
+ # Help
34
+ # ItemLookup
35
+ # ItemSearch
36
+ # ListLookup
37
+ # ListSearch
38
+ # SellerListingLookup
39
+ # SellerListingSearch
40
+ # SellerLookup
41
+ # SimilarityLookup
42
+ # TagLookup
43
+ # TransactionLookup
44
+ # VehiclePartLookup
45
+ # VehiclePartSearch
46
+ # VehicleSearch
47
+ #
48
+ # Remote shopping-carts are also supported. This adds the following operations:
49
+ #
50
+ # CartCreate
51
+ # CartAdd
52
+ # CartModify
53
+ # CartClear
54
+ # CartGet
55
+ #
56
+ # Finally, multiple operations and batch requests are also supported.
57
+ #
58
+ # Ruby/AWS supports request authentication, using your secret key to sign your
59
+ # requests to AWS.
60
+ #
61
+ # Beyond wrapping features readily available in the AWS API, Ruby/AWS also
62
+ # offers advanced features not directly supported by the AWS API, such as the
63
+ # ability to retrieve *all* results pages for a particular search, rather than
64
+ # having to manually deal with multiple AWS responses of 10 results per page.
65
+ #
66
+ # You can also retrieve product images and optionally overlay them with
67
+ # percentage discount icons.
68
+ #
69
+ # Another advanced feature is the ability to cache responses returned by AWS.
70
+ # If the cache is used (as it is by default), the results of each unique
71
+ # search will be cached and used for 24 hours. The cache can be manually
72
+ # flushed of all or just the expired entries.
73
+ #
74
+ # One other useful advanced feature is the ability to determine the
75
+ # appropriate Amazon locale for a given client, based on its IP address or
76
+ # host name. This allows you to perform AWS operations using the correct
77
+ # geographical Amazon site for any given client. German and Austrian clients
78
+ # can be made to interact with amazon.de, British and Irish clients with
79
+ # amazon.co.uk, etc.
80
+ #
81
+ #
82
+ # == Installation
83
+ #
84
+ # Please see the +INSTALL+ file supplied with the software for details of how
85
+ # to install Ruby/AWS. You can choose between an installation script and a
86
+ # RubyGems[http://www.rubygems.org/] installation.
87
+ #
88
+ # Note, however, if opting for the gem installation, that Ruby/AWS's RubyForge
89
+ # UNIX name is now ruby-aaws. The ruby-aws name was taken by {another
90
+ # project}[http://rubyforge.org/projects/ruby-aws/] and this namespace clash
91
+ # prevented remote installation of the Ruby/AWS gem.
92
+ #
93
+ #
94
+ # == Prerequisites
95
+ #
96
+ # Before you can use this library, you need to obtain an Amazon Web Services
97
+ # {access key
98
+ # ID}[https://aws-portal.amazon.com/gp/aws/developer/registration/index.html].
99
+ #
100
+ # You should also apply for an {Associates
101
+ # account}[http://docs.amazonwebservices.com/AWSECommerceService/2009-03-31/GSG/BecominganAssociate.html],
102
+ # although this isn't strictly necessary. If you do not explicitly provide an
103
+ # Associates tag in the operations you conduct via Ruby/AWS, the tag of the
104
+ # Ruby/AWS author will be used by default.
105
+ #
106
+ #
107
+ # == See Also
108
+ #
109
+ # Ultimately, the way to get the most from Ruby/AWS is to read the AWS
110
+ # documentation to get a feel for what is possible, and then experiment with
111
+ # the library to see how the calls to AWS are mapped to the Ruby world. You
112
+ # should also review this library's
113
+ # RDoc[http://www.ruby-doc.org/core/classes/RDoc.html]
114
+ # documentation[http://www.caliban.org/ruby/ruby-aws/] as well as the
115
+ # plain-text +README+ file that came with the archive.
116
+ #
117
+ # Additionally, there's a
118
+ # {mailing-list}[http://www.caliban.org/mailman/listinfo/ruby-aws] available,
119
+ # where you can discuss any Ruby/AWS-related subjects and issues.
120
+ #
121
+ # Please see the AWS Developer Resources {home
122
+ # page}[https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html],
123
+ # the Amazon Web Services API
124
+ # documentation[http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=5],
125
+ # and, in particular, the {release
126
+ # notes}[http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=17]
127
+ # for definitive information on the capabilities and inner workings of the AWS
128
+ # API.
129
+ #
130
+ #
131
+ # == Download
132
+ #
133
+ # Version 0.7.0
134
+ # === {gzip'ed tar archive}[http://www.caliban.org/files/ruby/ruby-aws-0.7.0.tar.gz]
135
+ # === {Ruby Gem}[http://www.caliban.org/files/ruby/ruby-aaws-0.7.0.gem]
136
+ # === {Fedora 9 RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-0.7.0-1.fc9.noarch.rpm]
137
+ # === {Fedora 9 doc RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-doc-0.7.0-1.fc9.noarch.rpm]
138
+ # === {Fedora 9 source RPM}[http://www.caliban.org/files/redhat/SRPMS/ruby-aws-0.7.0-1.fc9.src.rpm]
139
+ #
140
+ #
141
+ # ---
142
+ # Author:: Ian Macdonald <mailto:ian@caliban.org>
143
+ # Version:: 0.7.0
144
+ # Copyright:: (C) 2008-2009 Ian Macdonald
145
+ # Licence:: GPL[http://www.gnu.org/copyleft/gpl.html]
data/Rakefile CHANGED
@@ -1,36 +1,22 @@
1
- # $Id: Rakefile,v 1.11 2008/10/03 13:24:30 ianmacd Exp $
1
+ # $Id: Rakefile,v 1.15 2009/06/15 12:07:14 ianmacd Exp $
2
2
  #
3
3
 
4
4
  require 'rubygems'
5
- Gem::manage_gems
6
5
 
7
- require 'rake/gempackagetask'
8
-
9
- spec = Gem::Specification.new do |s|
10
- s.platform = Gem::Platform::RUBY
11
- s.name = 'ruby-aaws'
12
- s.rubyforge_project = 'Ruby/(A)AWS'
13
- s.version = '0.4.4'
14
- s.author = 'Ian Macdonald'
15
- s.email = 'ian@caliban.org'
16
- s.summary = 'Ruby interface to Amazon Associates Web Services'
17
- s.homepage = 'http://www.caliban.org/ruby/ruby-aws/'
18
- s.files = FileList[ 'example/*', 'lib/*.rb', 'lib/**/*.rb', 'test/*' ].to_a
19
- s.require_path = 'lib'
20
- s.test_files = Dir.glob( 'test/*.rb' )
21
- s.has_rdoc = true
22
- s.extra_rdoc_files = %w[ COPYING NEWS README README.rdoc ]
23
- s.required_ruby_version = '>= 1.8.6'
24
- # s.autorequire = 'amazon/aws/search'
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gemspec|
9
+ gemspec.name = "ruby-aaws"
10
+ gemspec.summary = "Ruby interface to Amazon Associates Web Services"
11
+ gemspec.description = "Ruby interface to Amazon Associates Web Services"
12
+ gemspec.email = "ian@caliban.org"
13
+ gemspec.homepage = "http://www.caliban.org/ruby/ruby-aws/"
14
+ gemspec.authors = ["Ian Macdonald", "Jamie Dyer"]
15
+ end
16
+ rescue LoadError
17
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
25
18
  end
26
19
 
27
- Rake::GemPackageTask.new( spec ) do |pkg|
28
- pkg.need_tar = true
29
- end
30
-
31
- task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
32
- puts 'Generated latest version.'
33
- end
34
20
 
35
21
  desc 'Produce HTML documentation in ./doc'
36
22
  task :doc do
@@ -47,8 +33,3 @@ task :doc do
47
33
  puts l
48
34
  end
49
35
  end
50
-
51
- desc 'Remove build and installation files'
52
- task :clean do
53
- FileUtils.rm_rf %w[ InstalledFiles config.save doc/ pkg/ ]
54
- end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.7.1
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby -w
2
+ #
3
+ # $Id: batch_operation,v 1.2 2009/02/20 00:37:15 ianmacd Exp $
4
+
5
+ require 'amazon/aws/search'
6
+
7
+ include Amazon::AWS
8
+ include Amazon::AWS::Search
9
+
10
+ rg = ResponseGroup.new( :Small )
11
+ req = Request.new
12
+ req.locale = 'uk'
13
+ req.cache = false
14
+
15
+ is = ItemSearch.new( 'Books', { 'Title' => 'ruby programming' } )
16
+ is2 = ItemSearch.new( 'Music', { 'Title' => 'stranglers' } )
17
+ #more_is = [ ItemSearch.new( 'Music', { 'Title' => 'stranglers' } ),
18
+ # ItemSearch.new( 'DVD', { 'Director' => 'scorsese' } ) ]
19
+
20
+ more_is = [ ItemSearch.new( 'Music', { 'Artist' => 'stranglers' } ) ]
21
+
22
+ is.batch( more_is )
23
+
24
+ batched_response = req.search( is, rg )
25
+ itemsearch = batched_response.item_search_response[0].items
26
+
27
+ puts itemsearch
data/example/example1 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
- # $Id: example1,v 1.4 2008/04/28 10:24:56 ianmacd Exp $
3
+ # $Id: example1,v 1.5 2009/06/02 01:09:51 ianmacd Exp $
4
4
 
5
5
  require 'amazon/aws'
6
6
  require 'amazon/aws/search'
@@ -44,7 +44,7 @@ response = request.search( is, rg, :ALL_PAGES ) do |page|
44
44
  # end
45
45
  # end
46
46
  # end
47
- printf( "Page %d had unique request ID %s.\n",
47
+ printf( "Page %d had unique request ID %s.\n",
48
48
  page_nr += 1,
49
49
  page.item_search_response[0].operation_request[0].request_id )
50
50
  printf( "Page %d contained %d result(s).\n",
@@ -56,7 +56,7 @@ end
56
56
  #
57
57
  nr_items = 0
58
58
  response.each do |page|
59
- page.item_search_response[0].items.each do |item_set|
59
+ page.item_search_response[0].items.each do |item_set|
60
60
  nr_items += item_set.item.size
61
61
  end
62
62
  end
data/example/item_lookup1 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
- # $Id: item_lookup1,v 1.5 2008/04/11 19:24:24 ianmacd Exp $
3
+ # $Id: item_lookup1,v 1.6 2009/02/20 00:13:38 ianmacd Exp $
4
4
 
5
5
  require 'amazon/aws'
6
6
  require 'amazon/aws/search'
@@ -8,16 +8,17 @@ require 'amazon/aws/search'
8
8
  include Amazon::AWS
9
9
  include Amazon::AWS::Search
10
10
 
11
- # Example of a batch operation, using the ASIN as the shared ID.
11
+ # Example of a batch operation.
12
12
  #
13
13
  # The MerchantId restriction is to ensure that we retrieve only items that
14
14
  # are for sale by Amazon. This is important when we later want to retrieve the
15
15
  # availability status.
16
16
  #
17
17
  il = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000AE4QEC',
18
- 'MerchantId' => 'Amazon' },
19
- { 'ItemId' => 'B000051WBE',
20
18
  'MerchantId' => 'Amazon' } )
19
+ il2 = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000051WBE',
20
+ 'MerchantId' => 'Amazon' } )
21
+ il.batch( il2 )
21
22
 
22
23
  # You can have multiple response groups.
23
24
  #
data/example/item_lookup2 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
- # $Id: item_lookup2,v 1.3 2008/04/11 19:24:24 ianmacd Exp $
3
+ # $Id: item_lookup2,v 1.4 2009/02/20 00:13:38 ianmacd Exp $
4
4
 
5
5
  require 'amazon/aws'
6
6
  require 'amazon/aws/search'
@@ -8,16 +8,17 @@ require 'amazon/aws/search'
8
8
  include Amazon::AWS
9
9
  include Amazon::AWS::Search
10
10
 
11
- # Example of a batch operation, using the ASIN as the shared ID.
11
+ # Example of a batch operation.
12
12
  #
13
13
  # The MerchantId restriction is to ensure that we retrieve only items that
14
14
  # are for sale by Amazon. This is important when we later want to retrieve the
15
15
  # availability status.
16
16
  #
17
17
  il = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000065RSW',
18
- 'MerchantId' => 'Amazon' },
19
- { 'ItemId' => 'B000A1INIU',
20
18
  'MerchantId' => 'Amazon' } )
19
+ il2 = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000A1INIU',
20
+ 'MerchantId' => 'Amazon' } )
21
+ il.batch( il2 )
21
22
 
22
23
  # You can have multiple response groups.
23
24
  #