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/INSTALL +7 -6
- data/NEWS +600 -272
- data/README +250 -163
- data/README.rdoc +145 -129
- data/Rakefile +13 -32
- data/VERSION +1 -0
- data/example/batch_operation +27 -0
- data/example/example1 +3 -3
- data/example/item_lookup1 +5 -4
- data/example/item_lookup2 +5 -4
- data/example/multiple_operation1 +4 -3
- data/example/vehicle_search +22 -0
- data/lib/amazon.rb +34 -16
- data/lib/amazon/aws.rb +496 -161
- data/lib/amazon/aws/search.rb +148 -28
- data/ruby-aaws.gemspec +117 -0
- data/test/setup.rb +5 -2
- data/test/tc_aws.rb +2 -2
- data/test/tc_browse_node_lookup.rb +62 -0
- data/test/tc_customer_content_lookup.rb +64 -0
- data/test/tc_help.rb +60 -0
- data/test/tc_item_lookup.rb +60 -0
- data/test/tc_item_search.rb +88 -3
- data/test/tc_list_lookup.rb +55 -0
- data/test/tc_list_search.rb +55 -0
- data/test/tc_multiple_operation.rb +211 -4
- data/test/tc_seller_listing_lookup.rb +58 -0
- data/test/tc_seller_listing_search.rb +70 -0
- data/test/tc_seller_lookup.rb +54 -0
- data/test/tc_shopping_cart.rb +9 -9
- data/test/tc_similarity_lookup.rb +59 -0
- data/test/tc_tag_lookup.rb +35 -0
- data/test/tc_transaction_lookup.rb +35 -0
- data/test/tc_vehicle_operations.rb +106 -0
- data/test/ts_aws.rb +16 -4
- metadata +85 -49
- data/ruby-aws.gemspec +0 -57
- data/ruby-aws.spec +0 -177
data/README.rdoc
CHANGED
@@ -1,129 +1,145 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
amazon.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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.
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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
|
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
|
+
# $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
|
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
|
#
|