ruby-aaws 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +372 -283
- data/README +101 -60
- data/README.rdoc +13 -9
- data/example/batch_operation +27 -0
- 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 +22 -8
- data/lib/amazon/aws.rb +270 -107
- data/lib/amazon/aws/search.rb +26 -3
- data/test/tc_multiple_operation.rb +12 -4
- data/test/tc_vehicle_operations.rb +106 -0
- data/test/ts_aws.rb +2 -1
- metadata +6 -2
data/README
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
$Id: README,v 1.
|
1
|
+
$Id: README,v 1.19 2009/02/20 00:37:15 ianmacd Exp $
|
2
2
|
|
3
3
|
|
4
4
|
Introduction
|
5
5
|
------------
|
6
6
|
|
7
|
-
Ruby/AWS is a Ruby language library that
|
8
|
-
programmer to retrieve information from the popular Amazon Web site via
|
7
|
+
Ruby/AWS is a Ruby language library that aims to make it relatively easy for
|
8
|
+
the programmer to retrieve information from the popular Amazon Web site via
|
9
9
|
Amazon's Associates Web Services (AWS). In addition to the original amazon.com
|
10
10
|
site, the local sites amazon.co.uk, amazon.de, amazon.fr, amazon.ca and
|
11
11
|
amazon.co.jp are also supported.
|
@@ -25,40 +25,43 @@ History and compatibility with Ruby/Amazon
|
|
25
25
|
------------------------------------------
|
26
26
|
|
27
27
|
In the beginning, there was Ruby/Amazon. This library was built around version
|
28
|
-
3.x of the Amazon Web Service API and first saw the light of day in
|
29
|
-
version of the Amazon API
|
28
|
+
3.x of the Amazon Web Service API and first saw the light of day in January
|
29
|
+
2004. The version of the Amazon API in use at the time was known as AWS 3.x.
|
30
30
|
|
31
31
|
Amazon later renamed AWS to ECS, or E-Commerce Service, for the launch of
|
32
|
-
version 4 of
|
32
|
+
version 4 of their API, a complete overhaul that provided no backward
|
33
33
|
compatibility with previous versions. The previous version of the API was
|
34
34
|
thenceforth sometimes referred to as ECS 3.
|
35
35
|
|
36
36
|
Demonstrating the wisdom and consistency for which large companies are
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
renowned, Amazon changed their mind once again in late 2007, reverting to the
|
38
|
+
familiar name of AWS. This time, however, it was said to stand for Associates
|
39
|
+
Web Service, rather than Amazon Web Service.
|
40
40
|
|
41
|
-
Since Amazon
|
42
|
-
AWS is now just one of many. It is therefore no longer appropriate
|
43
|
-
this library by a name so general as Ruby/Amazon, because it
|
44
|
-
|
41
|
+
Since Amazon first made AWS available, the number of Amazon Web APIs has
|
42
|
+
grown and AWS is now just one of many. It is therefore no longer appropriate
|
43
|
+
to call this library by a name so general as Ruby/Amazon, because it
|
44
|
+
provides an interface to just one of the Amazon Web APIs. Therefore, the
|
45
|
+
monicker for this library is Ruby/AWS.
|
45
46
|
|
46
47
|
Ruby/AWS is built around version 4 of the Amazon AWS API, which is
|
47
48
|
fundamentally different to version 3, both in terms of how requests are made
|
48
|
-
and data returned. The underlying structure of the XML response
|
49
|
-
changed from previous versions.
|
49
|
+
and the data returned. The underlying structure of the XML response has
|
50
|
+
radically changed from previous versions.
|
50
51
|
|
51
|
-
It has therefore not been
|
52
|
+
It has therefore not been practical for Ruby/AWS to retain any level of API
|
52
53
|
compatibility with Ruby/Amazon. Unfortunately, this means that any code
|
53
|
-
written for Ruby/Amazon will need to be rewritten to work with Ruby/AWS.
|
54
|
+
written for Ruby/Amazon will need to be rewritten to work with Ruby/AWS. The
|
55
|
+
good news is that, in most cases, this isn't as much work as it might sound.
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
Another bit of good news is that the /etc/amazonrc and ~/.amazonrc files used
|
58
|
+
by Ruby/Amazon _are_ compatible with Ruby/AWS. The only change required for
|
59
|
+
Ruby/AWS is the addition of a 'key_id' parameter, which should contain your
|
60
|
+
AWS Access Key ID. That fact notwithstanding, as of version 0.5.0, Ruby/AWS
|
61
|
+
also supports a more flexible, locale-specific configuration syntax.
|
59
62
|
|
60
63
|
Amazon finally decomissioned v3 of the AWS API on 2008-03-31. As a result, the
|
61
|
-
original Ruby/Amazon library no longer functions.
|
64
|
+
original Ruby/Amazon library no longer functions and is therefore obsolete.
|
62
65
|
|
63
66
|
|
64
67
|
AWS Access Key ID
|
@@ -68,26 +71,30 @@ You can obtain an AWS Access Key ID here:
|
|
68
71
|
|
69
72
|
https://aws-portal.amazon.com/gp/aws/developer/registration/index.html
|
70
73
|
|
71
|
-
|
72
|
-
|
74
|
+
You may see mention of Subscription IDs at the above location. Subscription
|
75
|
+
IDs are deprecated by Amazon and, in any case, not supported by Ruby/AWS.
|
76
|
+
Please obtain and use an AWS Access Key ID instead.
|
73
77
|
|
74
78
|
|
75
79
|
API version
|
76
80
|
-----------
|
77
81
|
|
78
|
-
Ruby/AWS currently requests the
|
82
|
+
Ruby/AWS currently requests the 2009-01-06 revision of the AWS API when
|
79
83
|
performing its operations:
|
80
84
|
|
81
|
-
http://docs.amazonwebservices.com/AWSECommerceService/
|
85
|
+
http://docs.amazonwebservices.com/AWSECommerceService/2009-01-06/DG/
|
86
|
+
|
87
|
+
However, a different version can be requested via the 'api' parameter in the
|
88
|
+
user configuration file.
|
82
89
|
|
83
90
|
|
84
91
|
Status and functionality
|
85
92
|
------------------------
|
86
93
|
|
87
|
-
Ruby/AWS is currently
|
94
|
+
Ruby/AWS is currently beta code. Amongst other things, this means:
|
88
95
|
|
89
|
-
- You will
|
90
|
-
|
96
|
+
- You will encounter bugs, but hopefully not too many and none too serious. If
|
97
|
+
you tell me about them, I will endeavour to fix them.
|
91
98
|
|
92
99
|
- The documentation is incomplete, but steadily getting better. Version 0.0.1
|
93
100
|
had virtually none, so consider yourself lucky.
|
@@ -96,7 +103,7 @@ Ruby/AWS is currently alpha code. Amongst other things, this means:
|
|
96
103
|
implemented. Yet others may not be _properly_ implemented.
|
97
104
|
|
98
105
|
Nevertheless, the AWS v4 API is now more or less fully supported, with only
|
99
|
-
|
106
|
+
small gaps in the functionality of some operations.
|
100
107
|
|
101
108
|
Currently implemented operations are:
|
102
109
|
|
@@ -127,23 +134,35 @@ Ruby/AWS is currently alpha code. Amongst other things, this means:
|
|
127
134
|
|
128
135
|
CartGet
|
129
136
|
|
130
|
-
Multiple operations
|
131
|
-
|
137
|
+
Multiple operations are supported, but not well tested.
|
138
|
+
|
139
|
+
As of version 0.5.0, batch operations are fully supported, using the
|
140
|
+
Operation#batch method.
|
141
|
+
|
142
|
+
Beware of bugs in this area. There appear to also be (undocumented)
|
132
143
|
Amazon-imposed restrictions on the use of multiple operations and batch
|
133
144
|
requests, so some experimentation on your part will probably be required to
|
134
145
|
determine what works and what doesn't.
|
146
|
+
|
147
|
+
The 2008-08-19 version of the AWS API added the following operations:
|
148
|
+
|
149
|
+
VehiclePartLookup
|
150
|
+
VehiclePartSearch
|
151
|
+
VehicleSearch
|
152
|
+
|
153
|
+
These are supported by Ruby/AWS as of version 0.5.0
|
135
154
|
|
136
155
|
- Classes, methods, constants and instance variables may change name in the
|
137
156
|
future. These various objects may appear from nowhere, change shape, grow,
|
138
|
-
shrink or disappear entirely.
|
139
|
-
|
140
|
-
process.
|
157
|
+
shrink or disappear entirely. Such fundamental changes will almost certainly
|
158
|
+
break existing code, so I will endeavour to keep them to a minimum.
|
141
159
|
|
142
160
|
In short, code written to work with this release of Ruby/AWS may stop working
|
143
|
-
when you upgrade to the next
|
144
|
-
|
145
|
-
|
146
|
-
|
161
|
+
when you upgrade to the next. In fact, it may even stop working _during_ this
|
162
|
+
release, because it's possible there are circumstances that would cause an
|
163
|
+
exception to be raised, that I haven't come across in my limited testing of
|
164
|
+
the code. It's also possible that future changes made by Amazon will affect
|
165
|
+
Ruby/AWS in unexpected ways.
|
147
166
|
|
148
167
|
That said, the Ruby/AWS's API is pretty stable at this point in time. I won't
|
149
168
|
break any of the method interfaces without seriously considering the merits of
|
@@ -163,10 +182,27 @@ Usage
|
|
163
182
|
First of all, create either /etc/amazonrc or ~/.amazonrc. Its contents should
|
164
183
|
look something like this:
|
165
184
|
|
166
|
-
|
185
|
+
# Any line that starts with a hash character is a comment.
|
186
|
+
key_id = '0Y44V8G41KCQPGF6XYZ2'
|
167
187
|
associate = 'fuzbarorg-21'
|
188
|
+
cache = false
|
189
|
+
locale = 'uk'
|
190
|
+
|
191
|
+
As of version 0.5.0 of Ruby/AWS, the following locale-specific configuration
|
192
|
+
syntax is also supported:
|
193
|
+
|
194
|
+
[global]
|
195
|
+
key_id = '0Y44V8G41KCQPGF6XYZ2'
|
168
196
|
locale = 'uk'
|
169
197
|
cache = false
|
198
|
+
# Request a specific version of the API.
|
199
|
+
# api = '2008-03-03'
|
200
|
+
|
201
|
+
[uk]
|
202
|
+
associate = 'fuzbarorg-21'
|
203
|
+
|
204
|
+
[us]
|
205
|
+
associate = 'fuzbarorg-20'
|
170
206
|
|
171
207
|
Because you're embedding your key ID in the file, you should protect it (on
|
172
208
|
UNIX and equivalent systems) by making it mode 0600:
|
@@ -471,7 +507,7 @@ differs not only by search type, but also by Amazon locale (amazon.com,
|
|
471
507
|
amazon.co.uk, amazon.de, etc.) and is prone to change with each minor revision
|
472
508
|
of the Amazon AWS API.
|
473
509
|
|
474
|
-
Even worse,
|
510
|
+
Even worse, the operations themselves can be illegal in certain locales.
|
475
511
|
TransactionLookup operations, for example, don't currently work in the UK
|
476
512
|
locale, but do work in the US locale.
|
477
513
|
|
@@ -483,35 +519,40 @@ of the corner cases and handle undocumented quirks.
|
|
483
519
|
|
484
520
|
With the highly dynamic nature of the Amazon environment, plus the sheer
|
485
521
|
number of operations, parameters, possible legal values and locales in the AWS
|
486
|
-
v4 API, this strict approach
|
487
|
-
|
522
|
+
v4 API, this strict approach would be completely impractical. Ruby/AWS
|
523
|
+
therefore doesn't even try.
|
488
524
|
|
489
525
|
Instead, it's now up to you to ensure that you perform legal operations and
|
490
526
|
pass in sensible parameters and values for the locale in which you're working.
|
491
527
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
the user.
|
528
|
+
The one exception to this rule is search index checking for ItemSearch
|
529
|
+
operations. Code that attempts to use an invalid SearchIndex will raise an
|
530
|
+
exception. The list of allowable search indices can be found in
|
531
|
+
Amazon::AWS::Operation::ItemSearch::SEARCH_INDICES.
|
497
532
|
|
498
|
-
|
499
|
-
|
500
|
-
|
533
|
+
Of course, even this check exposes the user to the risk that Amazon may later
|
534
|
+
add new search indices, which would continue to be unrecognised and ruled
|
535
|
+
invalid by Ruby/AWS until a future update. Whilst I have chosen to implement
|
536
|
+
this very basic level of checking, it may be removed in the future if it
|
537
|
+
becomes impractical to keep it current.
|
501
538
|
|
502
|
-
In
|
503
|
-
|
504
|
-
determine whether the search actually _is_ valid in your particular context.
|
539
|
+
In short, the validity of what goes into a search operation is your own
|
540
|
+
responsibility: garbage in, garbage out.
|
505
541
|
|
506
542
|
Thankfully, with the AWS Developer Guide at your side, it's largely common
|
507
543
|
sense which parameters and values can be used with each type of search. It's
|
508
|
-
less obvious when these differ by locale,
|
509
|
-
SearchIndex in the 'us'
|
510
|
-
|
544
|
+
less obvious when these differ by locale. For example, the 'Beauty'
|
545
|
+
SearchIndex was valid in the 'us', but not in the 'uk' until the 2009-01-06
|
546
|
+
revision of the AWS API.
|
547
|
+
|
548
|
+
Unfortunately, AWS abounds with such inconsistencies and they are prone to
|
549
|
+
change at any time.
|
511
550
|
|
512
551
|
The only way to apprise yourself of such quirks is to read Amazon's latest
|
513
552
|
developer documentation (and closely follow the release notes of each minor
|
514
|
-
API revision to make sure things haven't changed).
|
553
|
+
API revision to make sure things haven't changed). If you don't want to be
|
554
|
+
exposed to such API changes, use the 'api' parameter in the user configuration
|
555
|
+
file to request a particular version of the API.
|
515
556
|
|
516
557
|
The AWS Developer Connection pages may also be of use to you. In particular,
|
517
558
|
the forum for discussing AWS has proved useful to me over the years:
|
@@ -558,8 +599,8 @@ The ./examples subdirectory contains working examples of code.
|
|
558
599
|
Licence
|
559
600
|
-------
|
560
601
|
|
561
|
-
This software is copyright (C) 2008 Ian Macdonald and distributed under
|
562
|
-
terms of the GNU GENERAL PUBLIC LICENSE, a copy of which is included.
|
602
|
+
This software is copyright (C) 2008-2009 Ian Macdonald and distributed under
|
603
|
+
the terms of the GNU GENERAL PUBLIC LICENSE, a copy of which is included.
|
563
604
|
|
564
605
|
--
|
565
606
|
Ian Macdonald
|
data/README.rdoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# $Id: README.rdoc,v 1.
|
2
|
+
# $Id: README.rdoc,v 1.21 2009/02/20 00:45:17 ianmacd Exp $
|
3
3
|
#++
|
4
4
|
#
|
5
5
|
#
|
@@ -41,6 +41,9 @@
|
|
41
41
|
# SimilarityLookup
|
42
42
|
# TagLookup
|
43
43
|
# TransactionLookup
|
44
|
+
# VehiclePartLookup
|
45
|
+
# VehiclePartSearch
|
46
|
+
# VehicleSearch
|
44
47
|
#
|
45
48
|
# Remote shopping-carts are also supported. This adds the following operations:
|
46
49
|
#
|
@@ -92,7 +95,7 @@
|
|
92
95
|
# ID}[https://aws-portal.amazon.com/gp/aws/developer/registration/index.html].
|
93
96
|
#
|
94
97
|
# You should also apply for an {Associates
|
95
|
-
# account}[http://docs.amazonwebservices.com/AWSECommerceService/
|
98
|
+
# account}[http://docs.amazonwebservices.com/AWSECommerceService/2009-01-06/GSG/BecominganAssociate.html],
|
96
99
|
# although this isn't strictly necessary. If you do not explicitly provide an
|
97
100
|
# Associates tag in your calls through Ruby/AWS, the tag of the Ruby/AWS
|
98
101
|
# author will be used by default.
|
@@ -120,15 +123,16 @@
|
|
120
123
|
#
|
121
124
|
# == Download
|
122
125
|
#
|
123
|
-
# Version 0.
|
124
|
-
# === {gzip'ed tar archive}[http://www.caliban.org/files/ruby/ruby-aws-0.
|
125
|
-
# === {Ruby Gem}[http://www.caliban.org/files/ruby/ruby-aaws-0.
|
126
|
-
# === {Fedora 9 RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-0.
|
127
|
-
# === {Fedora 9 doc RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-doc-0.
|
128
|
-
# === {Fedora 9 source RPM}[http://www.caliban.org/files/redhat/SRPMS/ruby-aws-0.
|
126
|
+
# Version 0.5.0
|
127
|
+
# === {gzip'ed tar archive}[http://www.caliban.org/files/ruby/ruby-aws-0.5.0.tar.gz]
|
128
|
+
# === {Ruby Gem}[http://www.caliban.org/files/ruby/ruby-aaws-0.5.0.gem]
|
129
|
+
# === {Fedora 9 RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-0.5.0-1.fc9.noarch.rpm]
|
130
|
+
# === {Fedora 9 doc RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-doc-0.5.0-1.fc9.noarch.rpm]
|
131
|
+
# === {Fedora 9 source RPM}[http://www.caliban.org/files/redhat/SRPMS/ruby-aws-0.5.0-1.fc9.src.rpm]
|
129
132
|
#
|
130
133
|
#
|
131
134
|
# ---
|
132
135
|
# Author:: Ian Macdonald <mailto:ian@caliban.org>
|
133
|
-
# Version:: 0.
|
136
|
+
# Version:: 0.5.0
|
137
|
+
# Copyright:: (C) 2008-2009 Ian Macdonald
|
134
138
|
# Licence:: GPL[http://www.gnu.org/copyleft/gpl.html]
|
@@ -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/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
|
#
|
data/example/multiple_operation1
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
#
|
3
|
-
# $Id: multiple_operation1,v 1.
|
3
|
+
# $Id: multiple_operation1,v 1.2 2009/02/20 00:25:59 ianmacd Exp $
|
4
4
|
|
5
5
|
require 'amazon/aws/search'
|
6
6
|
|
@@ -14,9 +14,10 @@ include Amazon::AWS::Search
|
|
14
14
|
# availability status.
|
15
15
|
#
|
16
16
|
il = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000AE4QEC',
|
17
|
-
'MerchantId' => 'Amazon' },
|
18
|
-
{ 'ItemId' => 'B000051WBE',
|
19
17
|
'MerchantId' => 'Amazon' } )
|
18
|
+
il2 = ItemLookup.new( 'ASIN', { 'ItemId' => 'B000051WBE',
|
19
|
+
'MerchantId' => 'Amazon' } )
|
20
|
+
il.batch( il2 )
|
20
21
|
is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
|
21
22
|
|
22
23
|
mo = MultipleOperation.new( is, il )
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
#
|
3
|
+
# $Id: vehicle_search,v 1.1 2009/02/19 15:48:57 ianmacd Exp $
|
4
|
+
|
5
|
+
require 'amazon/aws/search'
|
6
|
+
|
7
|
+
include Amazon::AWS
|
8
|
+
include Amazon::AWS::Search
|
9
|
+
|
10
|
+
is = VehicleSearch.new( { 'Year' => 2008 } )
|
11
|
+
rg = ResponseGroup.new( 'VehicleMakes' )
|
12
|
+
|
13
|
+
req = Request.new
|
14
|
+
req.locale = 'us'
|
15
|
+
|
16
|
+
resp = req.search( is, rg )
|
17
|
+
makes = resp.vehicle_search_response[0].vehicle_years[0].vehicle_year[0].
|
18
|
+
vehicle_makes[0].vehicle_make
|
19
|
+
|
20
|
+
printf( "Search returned %d makes of vehicle for 2008.\n\n", makes.size )
|
21
|
+
|
22
|
+
makes.each { |make| puts make, '' }
|