bare-ruby-aws 0.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/COPYING +340 -0
- data/INSTALL +260 -0
- data/NEWS +808 -0
- data/README +580 -0
- data/lib/amazon.rb +144 -0
- data/lib/amazon/aws.rb +963 -0
- data/lib/amazon/aws/cache.rb +141 -0
- data/lib/amazon/aws/search.rb +458 -0
- data/test/setup.rb +56 -0
- data/test/tc_amazon.rb +20 -0
- data/test/tc_aws.rb +160 -0
- data/test/tc_item_search.rb +105 -0
- data/test/tc_operation_request.rb +64 -0
- data/test/tc_serialisation.rb +107 -0
- data/test/ts_aws.rb +24 -0
- metadata +91 -0
data/NEWS
ADDED
@@ -0,0 +1,808 @@
|
|
1
|
+
$Id: NEWS,v 1.21 2010/03/20 11:56:30 ianmacd Exp $
|
2
|
+
|
3
|
+
|
4
|
+
0.8.1 - 2010-03-20
|
5
|
+
------------------
|
6
|
+
|
7
|
+
1. Operation#query_parameters was faulty, because it had accidentally been
|
8
|
+
defined outside the Operation class.
|
9
|
+
|
10
|
+
This meant that it wasn't in the correct namespace, causing libraries that
|
11
|
+
included Ruby/AWS to place that method in a namespace unreachable by
|
12
|
+
Ruby/AWS itself. Scripts that used Ruby/AWS without defining other modules
|
13
|
+
and classes were unaffected.
|
14
|
+
|
15
|
+
2. In determining the home directory location of the .amazonrc file, we were
|
16
|
+
mistakenly concatenating ENV['HOMEDRIVE'] + ENV['HOMEPATH'] without first
|
17
|
+
checking that both were defined.
|
18
|
+
|
19
|
+
3. The version of the AWS API used is now 2009-11-01, the latest at the time
|
20
|
+
of writing.
|
21
|
+
|
22
|
+
|
23
|
+
0.8.0 - 2010-02-21
|
24
|
+
------------------
|
25
|
+
|
26
|
+
1. There is a new exception class, ObsolescenceError, which is raised when
|
27
|
+
an obsolete (i.e. no longer available) feature is used.
|
28
|
+
|
29
|
+
2. The batching and multiple operation code was basically unmaintainable. I
|
30
|
+
could no longer comprehend it, so I removed and rewrote it from scratch.
|
31
|
+
|
32
|
+
3. The implementation of MultipleOperation had a bug, whereby, if the second
|
33
|
+
operation was a batched operation, its parameters would overwrite those of
|
34
|
+
the first operation, leading to too few results returned.
|
35
|
+
|
36
|
+
This meant that the maximum number of operations that could be encapsulated
|
37
|
+
in a MultipleOperation was 3, not the proper 4, and, even then, only when
|
38
|
+
the batched operation was supplied as the first parameter, not the second.
|
39
|
+
|
40
|
+
4. There's a new ResponseGroup#response_group= method, the use of which is
|
41
|
+
transparent to the user. This makes it possible to assign response groups
|
42
|
+
to any kind of operation, even those encapsulated in batched and multiple
|
43
|
+
operations.
|
44
|
+
|
45
|
+
5. MultipleOperation.new can now accept an arbitrary number of operations in
|
46
|
+
its parameter list. This list may also be supplied in the form of an array.
|
47
|
+
|
48
|
+
Amazon still impose a maximum of 2 operations encapsulated in a multiple
|
49
|
+
operation, but there's no reason for Ruby/AWS to mirror this. If Amazon
|
50
|
+
later raise the limit, Ruby/AWS will require no modification to take
|
51
|
+
advantage of the new situation.
|
52
|
+
|
53
|
+
6. It's now possible to pass two batched operations to MultipleOperation.new,
|
54
|
+
allowing 4 base operations to be sent to AWS in a single request.
|
55
|
+
|
56
|
+
Note that Amazon still impose a limit of no more than 2 operations of the
|
57
|
+
same class in a single request, which means that to achieve the maximum of
|
58
|
+
4 base operations in a MultipleOperation, one must encapsulate two batched
|
59
|
+
operations of different classes.
|
60
|
+
|
61
|
+
7. A MultipleOperation that encapsulates only operations of the same class
|
62
|
+
will be commuted to a batch operation, resulting in the appropriate
|
63
|
+
response from Amazon.
|
64
|
+
|
65
|
+
For example, a MultipleOperation encapsulating two ItemSearch operations
|
66
|
+
will return an item_search_response, not a multiple_operation_response. A
|
67
|
+
MultipleOperation encapsulating an ItemSearch and an ItemLookup, on the
|
68
|
+
other hand, will still return a multiple_operation_response.
|
69
|
+
|
70
|
+
Previously, all multiple operations returned a multiple_operation_response.
|
71
|
+
|
72
|
+
8. It's no longer possible to pass a list of response groups as the second
|
73
|
+
parameter to Search::Request#search. This facility was deprecated in
|
74
|
+
Ruby/AWS 0.7.0 and has been removed altogether in 0.8.0 (shunting nr_pages
|
75
|
+
into place as the second and final parameter).
|
76
|
+
|
77
|
+
You must now directly assign to the operation's @response_group attribute.
|
78
|
+
|
79
|
+
In the case of a batched operation or a MultipleOperation, the response
|
80
|
+
groups will automatically propagate to the encapsulated operations.
|
81
|
+
|
82
|
+
An attempt to pass response groups as the second parameter to
|
83
|
+
Search::Request#search will now yield an ObsolescenceError exception.
|
84
|
+
|
85
|
+
9. Attempting to retrieve ALL_PAGES of a multiple page list, such as a
|
86
|
+
WishList, didn't work. Only the first page was retrieved. This is because
|
87
|
+
TotalPages is nested one level deeper in the XML response yielded by this
|
88
|
+
type of operation. The same is true of MultipleOperation responses.
|
89
|
+
|
90
|
+
10. Geolocation now associates Belgian clients with amazon.fr, rather than
|
91
|
+
amazon.co.uk. A Belgian client may not necessarily be a Francophone, but
|
92
|
+
this is probably still an improvement.
|
93
|
+
|
94
|
+
11. The version of the AWS API used is now 2009-10-01, the latest at the time
|
95
|
+
of writing. ItemSearch::SEARCH_INDICES has been updated with the latest
|
96
|
+
additions, Lighting and Outlet.
|
97
|
+
|
98
|
+
12. Ruby/AWS now depends on Ruby 1.8.6, not 1.8.7. This should make life
|
99
|
+
easier for some people, as many Linux distributions still come with 1.8.6.
|
100
|
+
|
101
|
+
|
102
|
+
0.7.0 - 2009-06-16
|
103
|
+
------------------
|
104
|
+
|
105
|
+
1. This release introduces a shorthand module method for each of the AWS
|
106
|
+
operations. These can be used to create less verbose code at the expense of
|
107
|
+
flexibility.
|
108
|
+
|
109
|
+
For example, we might normally write the following code:
|
110
|
+
|
111
|
+
is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
|
112
|
+
rg = ResponseGroup.new( :Large )
|
113
|
+
req = Request.new
|
114
|
+
response = req.search( is, rg )
|
115
|
+
|
116
|
+
but we could instead use ItemSearch's associated module method as follows:
|
117
|
+
|
118
|
+
response = Amazon::AWS.item_search( 'Books', { 'Title' => 'Ruby' } )
|
119
|
+
|
120
|
+
There are some important restrictions when compared to the standard way of
|
121
|
+
doing things:
|
122
|
+
|
123
|
+
a. Astute readers will note that there's no way to specify to the module
|
124
|
+
methods which response group(s) to use. Instead, a reasonable default
|
125
|
+
set for each type of operation will be used, as per the new
|
126
|
+
ResponseGroup::DEFAULT hash.
|
127
|
+
|
128
|
+
The exception to this is Amazon::AWS.multiple_operation, which has no
|
129
|
+
response groups of its own, instead applying those of the operations it
|
130
|
+
combines.
|
131
|
+
|
132
|
+
Because no access is provided to the Request object used by the module
|
133
|
+
method, it's also not possible to batch operations with Operation#batch
|
134
|
+
when using this form of the search.
|
135
|
+
|
136
|
+
On the other hand, you can use the Amazon::AWS.multiple_operation module
|
137
|
+
method to achieve more or less the same thing:
|
138
|
+
|
139
|
+
Amazon::AWS.multiple_operation( op1, op2 )
|
140
|
+
|
141
|
+
When op1 and op2 are of the same class, the effect is similar to
|
142
|
+
batching two operations. The main difference is in the structure of the
|
143
|
+
XML document returned by AWS.
|
144
|
+
|
145
|
+
b. Similarly, one can't influence the key ID, associate tag, locale, cache
|
146
|
+
or user agent used for the request. These are all set as per
|
147
|
+
~/.amazonrc.
|
148
|
+
|
149
|
+
Likewise, the number of results pages to fetch will always be 1.
|
150
|
+
|
151
|
+
c. The module methods have no RDoc documentation, because they are
|
152
|
+
dynamically generated.
|
153
|
+
|
154
|
+
Basically, the short form module methods are there as a convenience, but
|
155
|
+
that convenience comes at the expense of flexibility. If they don't meet
|
156
|
+
your needs, you will have to resort to the standard longhand form.
|
157
|
+
|
158
|
+
2. There's now an alternative to passing the list of desired response groups
|
159
|
+
as the second parameter to Request#search.
|
160
|
+
|
161
|
+
The second parameter of that method is now optional and *nil* by default.
|
162
|
+
Instead, you may assign to the response_group attribute of your operation
|
163
|
+
object.
|
164
|
+
|
165
|
+
For example:
|
166
|
+
|
167
|
+
is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
|
168
|
+
is.response_group = ResponseGroup.new( :Large )
|
169
|
+
req = Request.new
|
170
|
+
response = req.search( is )
|
171
|
+
|
172
|
+
Note that the @response_group variable will be initialised at the
|
173
|
+
time the operation object is instantiated. It will be assigned the same
|
174
|
+
reasonable default as used by the equivalent module method, namely
|
175
|
+
that specified by the new ResponseGroup::DEFAULT hash.
|
176
|
+
|
177
|
+
Specifying the desired response groups inside your operation object has at
|
178
|
+
least two advantages over passing the list to Request#search:
|
179
|
+
|
180
|
+
a. You can maintain a separate response group set per operation, rather
|
181
|
+
than having to pass a differen set to Request#search for each operation.
|
182
|
+
|
183
|
+
b. A reasonable default response group set can be used for any given
|
184
|
+
operation if you don't supply one.
|
185
|
+
|
186
|
+
3. More and more people are moving to Ruby 1.9, so this release of Ruby/AWS
|
187
|
+
has been tested to work with Ruby 1.9.1p129, the latest version at the time
|
188
|
+
of writing. Attaining compatibility with 1.9 is a little tricky, because of
|
189
|
+
the way in which strings are no longer treated as sequences of bytes in
|
190
|
+
that version. Instead, they have knowledge of their encoding.
|
191
|
+
|
192
|
+
There may be one or two obscure 1.9-related bugs remaining, but all of the
|
193
|
+
unit tests pass, at least.
|
194
|
+
|
195
|
+
4. The signing of requests, introduced in Ruby/AWS 0.6.0, produced problems
|
196
|
+
for people with a version of OpenSSL earlier than 0.9.8.
|
197
|
+
|
198
|
+
The code will now check whether there is OpenSSL support for the SHA-256
|
199
|
+
Secure Hash Algorithm before attempting to use it. If not, each attempt to
|
200
|
+
sign a request will result in a warning if $DEBUG is used.
|
201
|
+
|
202
|
+
Once again, I remind you that Amazon intends to make request authentication
|
203
|
+
compulsory on 15th August 2009, so this change to Ruby/AWS only lets users
|
204
|
+
with an ancient OpenSSL library off the hook until then.
|
205
|
+
|
206
|
+
5. A second bug with the signing of requests occurred on Windows platforms.
|
207
|
+
Requests were not properly timestamped. This was due to deficiencies in the
|
208
|
+
underlying strftime(3) library function, but has now been fixed.
|
209
|
+
|
210
|
+
6. Finally, knowledge of a handful of relatively new search indices, such as
|
211
|
+
UnboxVideo, was missing. This has now been added. The AWS documentation is
|
212
|
+
terribly inconsistent in this regard, providing several different, yet
|
213
|
+
supposedly complete lists of valid search indices at various points
|
214
|
+
throughout the document.
|
215
|
+
|
216
|
+
|
217
|
+
0.6.0 - 2009-05-26
|
218
|
+
------------------
|
219
|
+
|
220
|
+
1. Requests to AWS can now be signed in order to authenticate them. Amazon
|
221
|
+
plans to make the signing of requests mandatory as of 15th August 2009, so
|
222
|
+
it is recommended to start doing so now.
|
223
|
+
|
224
|
+
To have your requests automatically signed by Ruby/AWS, simply add the
|
225
|
+
'secret_key_id' parameter to your ~/.amazonrc configuration file. Its value
|
226
|
+
should, rather predictably, be your secret access key, which can be
|
227
|
+
retrieved here:
|
228
|
+
|
229
|
+
https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key
|
230
|
+
|
231
|
+
You needn't be concerned about Amazon's warnings not to show your secret
|
232
|
+
key to anyone else, because it will be used only for signing requests,
|
233
|
+
prior to sending them. The key itself will not be sent over the network to
|
234
|
+
Amazon, even in encrypted form.
|
235
|
+
|
236
|
+
In order to incorporate the new functionality, minor changes had to be made
|
237
|
+
to the way the AWS request URLs are encoded. This change means that
|
238
|
+
previous requests cached by earlier versions of Ruby/AWS will not be found
|
239
|
+
in the cache. This is a minor, one-time inconvenience, and it just means
|
240
|
+
that the requests will be performed and cached again.
|
241
|
+
|
242
|
+
2. When Amazon's AWS servers check whether the correct signature has been
|
243
|
+
applied to a request, they recalculate the signature based on the data in
|
244
|
+
the request and check for a match with the signature supplied by Ruby/AWS.
|
245
|
+
|
246
|
+
This introduces a complicating factor, namely the treatment of non-ASCII
|
247
|
+
characters in the request, such as accented letters. When recalculating the
|
248
|
+
signature, Amazon will use the UTF-8 representation of any such characters.
|
249
|
+
This will cause a signature mismatch if you used a different encoding, such
|
250
|
+
as ISO-8859-1 (a.k.a. Latin-1), when you supplied values for your request
|
251
|
+
parameters.
|
252
|
+
|
253
|
+
Ruby/AWS can't (reliably) dynamically determine which character encoding
|
254
|
+
your strings use, so this information can now be supplied via the
|
255
|
+
~/.amazonrc configuration file, using the 'encoding' parameter. This should
|
256
|
+
be set to whichever encoding you use. If left unset, it defaults to UTF-8.
|
257
|
+
An exception will be raised if you attempt to use an invalid (i.e. unknown)
|
258
|
+
encoding.
|
259
|
+
|
260
|
+
Currently, the encoding you use makes no difference unless your requests
|
261
|
+
are being signed, but because signing will soon be mandatory, I recommend
|
262
|
+
you explicitly state which encoding you intend to use.
|
263
|
+
|
264
|
+
You may also change the encoding in use at any time by assigning to the
|
265
|
+
@encoding instance variable of your Request object.
|
266
|
+
|
267
|
+
3. The robustness of the software has been improved by handling the following
|
268
|
+
additional exceptions while communicating with the AWS servers:
|
269
|
+
Errno::ECONNREFUSED, Errno::ECONNABORTED, Errno::ETIMEDOUT and
|
270
|
+
Timeout::Error. Users have reported that all of these occur from time to
|
271
|
+
time, although only Windows platforms seem to suffer from
|
272
|
+
Errno::ECONNABORTED.
|
273
|
+
|
274
|
+
4. The version of the AWS API used is now 2009-03-31, the latest at the time
|
275
|
+
of writing.
|
276
|
+
|
277
|
+
5. <RANT>
|
278
|
+
Amazon must have appointed a new interim Senior Vice-President of
|
279
|
+
Outward-Facing Moniker Reconciliation or something, because earlier this
|
280
|
+
month, on 8th May, I received an e-mail from Amazon, informing me that the
|
281
|
+
Web service formerly known as Amazon Web Services, latterly the E-Commerce
|
282
|
+
Service, and then, until this month, the Amazon Associates Web Service, is
|
283
|
+
to undergo yet another name change.
|
284
|
+
|
285
|
+
Once again, the reason for the new moniker is that it ostensibly "more
|
286
|
+
accurately reflects the purpose of the API". The new sobriquet is the
|
287
|
+
highly reflective 'Product Advertising API'.
|
288
|
+
|
289
|
+
It never ceases to amaze me that the collective intellectual might of a
|
290
|
+
company as large and resourceful as Amazon cannot, over a period of five
|
291
|
+
years, converge to decisively name an API.
|
292
|
+
|
293
|
+
How long until the reins of responsibility for this offering change hands
|
294
|
+
once again and the next in a growing line of misguided middle managers
|
295
|
+
decides that he can best raise his profile with his superiors by changing
|
296
|
+
the name of the API to "better reflect its purpose"?
|
297
|
+
|
298
|
+
Well, I'm resistant to change, especially stupid, time-wasting changes, so
|
299
|
+
I'll be continuing to refer to AWS as AWS for the foreseeable future. When
|
300
|
+
I say AWS, you'll know I mean the product whose name is woefully subject to
|
301
|
+
Amazon's whimsy.
|
302
|
+
|
303
|
+
The same e-mail informed me that Amazon would soon be introducing mandatory
|
304
|
+
authentication of AWS requests.
|
305
|
+
|
306
|
+
I downloaded the latest developer guide, wrote some code to implement
|
307
|
+
request signatures, and then spent a good couple of hours trying to make my
|
308
|
+
code produce the sample results shown in the developer guide.
|
309
|
+
|
310
|
+
Ultimately, I realised that the sample requests in the developer guide
|
311
|
+
could not have produced the output claimed by the documentation.
|
312
|
+
|
313
|
+
Not only that, but 3 of the 10 steps in the developer guide, in the section
|
314
|
+
detailing how to sign AWS requests, contain critical errors. This means
|
315
|
+
that Amazon didn't once follow their own documentation to verify its
|
316
|
+
correctness.
|
317
|
+
|
318
|
+
Most of the mistakes have since been silently rectified by Amazon, without
|
319
|
+
any mention on the AWS forum or revising the document version. Who knows
|
320
|
+
how often the developer guide changes on a day to day basis. I had thought
|
321
|
+
each dated version to be a static, completed work, but this is apparently
|
322
|
+
not the case.
|
323
|
+
</RANT>
|
324
|
+
|
325
|
+
|
326
|
+
0.5.1 - 2009-03-29
|
327
|
+
------------------
|
328
|
+
|
329
|
+
1. Catch Errno::EPIPE on server connections (Errno::ECONNRESET was already
|
330
|
+
caught). This can occur when the connection times out due to lack of use.
|
331
|
+
Running Ruby in debug mode will print the error message text when such an
|
332
|
+
exception is caught.
|
333
|
+
|
334
|
+
2. The version of the AWS API used is now 2009-02-01, the latest at the time
|
335
|
+
of writing.
|
336
|
+
|
337
|
+
3. The sequence numbering of shopping cart items incorrectly started from 2
|
338
|
+
instead of 1, but didn't cause a problem in practice.
|
339
|
+
|
340
|
+
|
341
|
+
0.5.0 - 2009-02-20
|
342
|
+
------------------
|
343
|
+
|
344
|
+
1. The configuration files (/etc/amazonrc and typically ~/.amazonrc) are now
|
345
|
+
locale-specific. Global and locale-specific settings can now be placed in
|
346
|
+
their own sections. For example:
|
347
|
+
|
348
|
+
Old style .amazonrc:
|
349
|
+
|
350
|
+
associate = 'caliban-21'
|
351
|
+
locale = 'uk'
|
352
|
+
cache = false
|
353
|
+
key_id = '0Y44V8FAFNM119C6XYZ2'
|
354
|
+
|
355
|
+
New style .amazonrc:
|
356
|
+
|
357
|
+
[global]
|
358
|
+
locale = 'uk'
|
359
|
+
cache = false
|
360
|
+
key_id = '0Y44V8FAFNM119C6XYZ2'
|
361
|
+
|
362
|
+
[uk]
|
363
|
+
associate = 'calibanorg-21'
|
364
|
+
|
365
|
+
[us]
|
366
|
+
associate = 'calibanorg-20'
|
367
|
+
|
368
|
+
|
369
|
+
The old style of configuration is still supported.
|
370
|
+
|
371
|
+
2. ItemLookup.new and SellerListingLookup.new no longer take a third
|
372
|
+
parameter, b_parameters. Instead, the new Operation#batch method can be
|
373
|
+
used to create batch operations.
|
374
|
+
|
375
|
+
Operation#batch can batch multiple operations of any class, not just
|
376
|
+
ItemLookup and SellerListingLookup. The only requirement if that all
|
377
|
+
batched operations must be of the same class.
|
378
|
+
|
379
|
+
If you want to send multiple operations of different classes as a single
|
380
|
+
request, you must still use the MultipleOperation class.
|
381
|
+
|
382
|
+
3. VehiclePartLookup, VehiclePartSearch and VehicleSearch operations (which
|
383
|
+
were added in the 2008-08-19 revision of the AWS API, are now supported.
|
384
|
+
However, VehiclePartLookup is the only one of these that currently supports
|
385
|
+
pagination.
|
386
|
+
|
387
|
+
4. The list of allowable search indices for ItemSearch operations has been
|
388
|
+
updated in accordance with the latest AWS documentation.
|
389
|
+
|
390
|
+
5. Parameter checking for ItemSearch operations no longer occurs. It was
|
391
|
+
impractical to keep the list of valid parameters concurrent with AWS.
|
392
|
+
Related constants have therefore also been removed.
|
393
|
+
|
394
|
+
6. The version of the AWS API used is now 2009-01-06, the latest at the time
|
395
|
+
of writing.
|
396
|
+
|
397
|
+
The configuration file now supports a new global parameter for requesting a
|
398
|
+
different version of the API. For example:
|
399
|
+
|
400
|
+
api = '2008-08-19'
|
401
|
+
|
402
|
+
7. While testing the ability to request a specific version of the AWS API, I
|
403
|
+
encountered a new kind of AWS error, the internal error, which is reported
|
404
|
+
using a different XML construct to that used for all other error
|
405
|
+
conditions.
|
406
|
+
|
407
|
+
I triggered one of these internal errors when I attempted an operation, a
|
408
|
+
VehicleSearch, that did not yet exist in the older version of the API that
|
409
|
+
I requested.
|
410
|
+
|
411
|
+
This type of error now throws a generic Amazon::AWS::Error::AWSError
|
412
|
+
exception.
|
413
|
+
|
414
|
+
It's reasonable to assume that there are other conditions that would cause
|
415
|
+
an internal AWS error to occur. These, too, will be raised as an exception.
|
416
|
+
|
417
|
+
Unfortunately, AWS supplies no information on the cause of such internal
|
418
|
+
errors, so Ruby/AWS is unable to pass on any clues to the user.
|
419
|
+
|
420
|
+
|
421
|
+
0.4.4 - 2008-10-03
|
422
|
+
------------------
|
423
|
+
|
424
|
+
1. It's now possible to have Ruby/AWS use a user configuration file with a
|
425
|
+
name other than .amazonrc. This is achieved by defining $AMAZONRCFILE. If
|
426
|
+
left undefined, the default of .amazonrc is used.
|
427
|
+
|
428
|
+
2. Locations other than $HOME were not being checked for .amazonrc. This bug
|
429
|
+
has now been fixed.
|
430
|
+
|
431
|
+
|
432
|
+
0.4.3 - 2008-09-22
|
433
|
+
------------------
|
434
|
+
|
435
|
+
1. $AMAZONRCDIR is now searched for .amazonrc before $HOME and the other
|
436
|
+
directories. This allows a user-defined location to be used for the user
|
437
|
+
configuration file.
|
438
|
+
|
439
|
+
2. There is a new top-level class of exception for Ruby/AWS,
|
440
|
+
Amazon::AmazonError.
|
441
|
+
|
442
|
+
Most non-operational exceptions, such as Amazon::AWS::HTTPError,
|
443
|
+
Amazon::Config::ConfigError,
|
444
|
+
Amazon::AWS::Search::Request::AccessKeyIdError,
|
445
|
+
Amazon::AWS::Search::Request::LocaleError and
|
446
|
+
Amazon::AWS::ShoppingCart::CartError are now immediate subclasses of
|
447
|
+
AmazonError. Previously, they were subclasses of StandardError.
|
448
|
+
|
449
|
+
3. Amazon::AWS::Error::AWSError was previously a class that generated
|
450
|
+
exceptions, but it's now simply a container class derived from AmazonError.
|
451
|
+
All operational exceptions -- the ones whose class is dynamically created
|
452
|
+
when AWS returns an error -- are now subclasses of AWSError. Previously,
|
453
|
+
they were immediate subclasses of StandardError.
|
454
|
+
|
455
|
+
This has the advantage of allowing all of the exceptions resulting from
|
456
|
+
operational errors to be caught by rescuing just the container class,
|
457
|
+
AWSError.
|
458
|
+
|
459
|
+
|
460
|
+
0.4.2 - 2008-09-11
|
461
|
+
------------------
|
462
|
+
|
463
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
464
|
+
now 2008-08-19. This is the latest at the time of writing.
|
465
|
+
|
466
|
+
2. The exception class Amazon::Config::ConfigError was mysteriously not
|
467
|
+
defined.
|
468
|
+
|
469
|
+
3. Amazon::Config.new now accepts an optional argument, config_str, which may
|
470
|
+
contain the string equivalent of a config file's contents. When config_str
|
471
|
+
is not nil (nil is the default), this string is read instead of
|
472
|
+
/etc/amazonrc and ~/.amazonrc. This addition is really just to aid
|
473
|
+
unit-testing of the Amazon::Config class, as Amazon::Config.new never needs
|
474
|
+
to be called by user code.
|
475
|
+
|
476
|
+
4. Config file lines may now contain leading whitespace.
|
477
|
+
|
478
|
+
5. The Amazon::AWS::MAX_PAGES constant has gone, replaced by the PAGINATION
|
479
|
+
hash. Only ItemSearch should use ItemPage to page through results up to
|
480
|
+
MAX_PAGES when ALL_PAGES has been requested, but the same approach was
|
481
|
+
attempted for all types of operation.
|
482
|
+
|
483
|
+
Each operation has its own pagination parameter and its own maximum number
|
484
|
+
of pages that can be fetched. This is now stored in the
|
485
|
+
Amazon::AWS::PAGINATION hash.
|
486
|
+
|
487
|
+
Note that ItemLookup has three possible pagination parameters: OfferPage,
|
488
|
+
VariationPage and ReviewPage. Ruby/AWS uses OfferPage for the purposes of
|
489
|
+
ALL_PAGES.
|
490
|
+
|
491
|
+
Operations that do not explicitly provide a pagination parameter (or, at
|
492
|
+
least, those for which there isn't one listed in the AWS Developer's Guide)
|
493
|
+
use ItemPage for pagination up to page 400. In practice, this is likely to
|
494
|
+
throw an exception, as such operations almost certainly don't support
|
495
|
+
multiple results pages.
|
496
|
+
|
497
|
+
|
498
|
+
0.4.1 - 2008-08-18
|
499
|
+
------------------
|
500
|
+
|
501
|
+
1. The exception class Amazon::AWS::HTTPError was not actually defined, which
|
502
|
+
caused an error when an attempt was made to raise an instance of it.
|
503
|
+
|
504
|
+
2. If you're using Windows, %HOME% typically isn't defined. Therefore, the
|
505
|
+
following sequence of paths is now searched for your .amazonrc
|
506
|
+
configuration file:
|
507
|
+
|
508
|
+
%HOME%
|
509
|
+
%HOMEDRIVE% + %HOMEPATH%
|
510
|
+
%USERPROFILE%
|
511
|
+
|
512
|
+
Choose one of these at your convenience.
|
513
|
+
|
514
|
+
3. The Ruby/AWS gem has been renamed ruby-aaws (from ruby-aws) to avoid a
|
515
|
+
namespace clash with another project. This clash prevented remote
|
516
|
+
installation of the gem.
|
517
|
+
|
518
|
+
|
519
|
+
0.4.0 - 2008-07-05
|
520
|
+
------------------
|
521
|
+
|
522
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
523
|
+
now 2008-06-26. This is the latest at the time of writing.
|
524
|
+
|
525
|
+
2. A new method, Amazon::AWS::ShoppingCart::Cart#cart_get, has been added, to
|
526
|
+
allow the retrieval of an existing shopping-cart from AWS. This is
|
527
|
+
necessary when the original Cart object no longer exists.
|
528
|
+
|
529
|
+
3. A bug in Amazon::AWS::ShoppingCart::Cart#cart_modify has been fixed, which
|
530
|
+
caused carts with no items in their active section to raise an exception.
|
531
|
+
|
532
|
+
|
533
|
+
0.3.3 - 2008-06-23
|
534
|
+
------------------
|
535
|
+
|
536
|
+
1. YAML.aws_load has been removed. Its functionality is available directly
|
537
|
+
from Amazon::AWS::AWSObject.yaml_load and it wasn't logical or necessary to
|
538
|
+
duplicate that in the YAML class itself. There was no corresponding
|
539
|
+
Marshal.aws_load method, but if there had been, that, too, would have been
|
540
|
+
removed.
|
541
|
+
|
542
|
+
2. Ruby/AWS is finally available as a RubyGems package and can be found here:
|
543
|
+
|
544
|
+
http://www.caliban.org/files/ruby/ruby-aws-0.3.3.gem
|
545
|
+
|
546
|
+
The enclosed Rakefile can be used to build the gem from scratch. First make
|
547
|
+
sure you have rake and rubygems installed, and then simply type 'rake' in
|
548
|
+
the top level directory of the archive. The gem will be generated and
|
549
|
+
placed in the ./pkg subdirectory, from where you can 'sudo gem install' it.
|
550
|
+
|
551
|
+
This is my first gem, so bear with me. It appears to work properly, but I
|
552
|
+
offer no guarantees. One thing that doesn't currently work is installing
|
553
|
+
the package with gem's -t option to run the supplied unit tests.
|
554
|
+
|
555
|
+
More information about RubyGems can be found here:
|
556
|
+
|
557
|
+
http://www.rubygems.org/
|
558
|
+
|
559
|
+
|
560
|
+
0.3.2 - 2008-06-17
|
561
|
+
------------------
|
562
|
+
|
563
|
+
1. Serialisation, e.g. with Marshal and YAML, has been a problem until now.
|
564
|
+
|
565
|
+
This is because subclasses of Amazon::AWS::AWSObject are created as needed
|
566
|
+
when XML responses from AWS are parsed. Whilst there is no problem dumping
|
567
|
+
objects instantiated from such classes, the difficulty arises when later
|
568
|
+
loading and attempting to reinstantiate them in a new process, because the
|
569
|
+
dynamic classes from which they were spawned no longer exist.
|
570
|
+
|
571
|
+
The solution to the problem comes in the form of the new methods
|
572
|
+
Amazon::AWS::AWSObject.load and Amazon::AWS::AWSObject.yaml_load. Use these
|
573
|
+
as alternatives to Marshal.load and YAML.load, respectively.
|
574
|
+
|
575
|
+
|
576
|
+
0.3.1 - 2008-06-10
|
577
|
+
------------------
|
578
|
+
|
579
|
+
This release mostly features refinements to the support for remote
|
580
|
+
shopping-carts.
|
581
|
+
|
582
|
+
1. The 'Save For Later' area of remote shopping-carts is now implemented.
|
583
|
+
|
584
|
+
Cart#cart_modify now takes an extra parameter, save_for_later. If true,
|
585
|
+
items are moved from the active to the Save For Later area of the cart. If
|
586
|
+
false, they are moved in the opposite direction.
|
587
|
+
|
588
|
+
In both cases, the quantity parameter is ignored, because attempting to
|
589
|
+
pass it through to AWS results in an error, even though the AWS
|
590
|
+
documentation claims this can be done to move partial quantities from one
|
591
|
+
area of the cart to the other.
|
592
|
+
|
593
|
+
2. Cart objects now have a @saved_for_later_items attribute, aliased to
|
594
|
+
@saved_items and @saved for brevity. Take your pick.
|
595
|
+
|
596
|
+
3. @cart_items is now set to [] when Cart.new is called. Previously, it wasn't
|
597
|
+
set until Cart#cart_create was used, at which time it was set to nil.
|
598
|
+
@saved_for_later_items is also set to [] by Cart.new.
|
599
|
+
|
600
|
+
4. Cart#include? now also returns true if the item being queried is in the
|
601
|
+
Save For Later area of the cart. Previously, only the active area was
|
602
|
+
inspected.
|
603
|
+
|
604
|
+
5. New methods, Cart#active? and Cart#saved_for_later? (alias Cart#saved?),
|
605
|
+
return whether or not an item is present in a particular area of the cart.
|
606
|
+
If the item is present, its CartItemId is returned; otherwise 'false'.
|
607
|
+
|
608
|
+
6. A bug that caused shopping-cart transactions to use the cache if one was
|
609
|
+
requested has been fixed. Shopping-carts should never use the cache under
|
610
|
+
any circumstances.
|
611
|
+
|
612
|
+
7. Request objects can now have their @cache attribute assigned to. A Cache
|
613
|
+
object may be directly assigned to it, or you may assign the value 'true'.
|
614
|
+
If @cache is set to 'true', a Cache object will automatically be assigned
|
615
|
+
to it the next time @cache is referenced. This is most useful when one
|
616
|
+
wishes to switch from using no cache to using one, or vice versa.
|
617
|
+
|
618
|
+
8. Cache#flush_expired invariably threw an exception. This bug has been fixed.
|
619
|
+
|
620
|
+
9. Geolocation of users by host and IP address now raises an
|
621
|
+
Amazon::Locale::GeoError exception if the host or IP address is
|
622
|
+
unresolvable.
|
623
|
+
|
624
|
+
There's a new Ruby/AWS mailing-list for discussion of the development and
|
625
|
+
usage of this library:
|
626
|
+
|
627
|
+
http://www.caliban.org/mailman/listinfo/ruby-aws
|
628
|
+
|
629
|
+
|
630
|
+
0.3.0 - 2008-05-19
|
631
|
+
------------------
|
632
|
+
|
633
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
634
|
+
now 2008-04-07. This is the latest at the time of writing.
|
635
|
+
|
636
|
+
2. Remote shopping-carts are now implemented. See the
|
637
|
+
Amazon::AWS::ShoppingCart module and the Amazon::AWS::ShoppingCart::Cart
|
638
|
+
class in ./amazon/aws/shoppingcart.rb for more details.
|
639
|
+
|
640
|
+
Basically, the new methods are Cart.new, Cart#cart_create, Cart#cart_add,
|
641
|
+
Cart#cart_modify and Cart#cart_clear. There's also Cart#each for iterating
|
642
|
+
over the items in a cart.
|
643
|
+
|
644
|
+
This adds the following AWS operations to the list of those supported:
|
645
|
+
|
646
|
+
CartCreate
|
647
|
+
CartAdd
|
648
|
+
CartModify
|
649
|
+
CartClear
|
650
|
+
|
651
|
+
It's currently not possible to update a wishlist at purchase time by
|
652
|
+
referring to the item's ListItemId when adding it to a cart.
|
653
|
+
|
654
|
+
It's also currently not possible to add items to the 'Saved For Later'
|
655
|
+
section of the cart.
|
656
|
+
|
657
|
+
3. A new iterator method, AWSObject#each, yields each |property, value| of the
|
658
|
+
AWSObject.
|
659
|
+
|
660
|
+
4. The AWSObject and AWSArray classes have received a few new helper methods
|
661
|
+
that should make AWSObject and single element AWSArray objects behave more
|
662
|
+
akin to strings when they are being compared with strings, matched against
|
663
|
+
regexes, etc.
|
664
|
+
|
665
|
+
5. An otherwise undocumented method, AWSObject#kernel, provides unnested (i.e.
|
666
|
+
top level) AWSObject objects with a shortcut reference to the data most
|
667
|
+
likely of interest to the user.
|
668
|
+
|
669
|
+
For example, if a top level AWSObject is formed as the result of an
|
670
|
+
ItemSearch, one might normally refer to the items returned with something
|
671
|
+
like this:
|
672
|
+
|
673
|
+
foo.item_search_response[0].items[0].item
|
674
|
+
|
675
|
+
AWSObject#kernel allows the same data to be referred to as follows:
|
676
|
+
|
677
|
+
foo.kernel
|
678
|
+
|
679
|
+
The path to the data is programatically determined, so this method only
|
680
|
+
works for top level AWSObject objects created by a class of operation whose
|
681
|
+
name can be used to derive the path. This is why this method is not
|
682
|
+
mentioned in the RDoc documentation.
|
683
|
+
|
684
|
+
6. When searches are performed, greater efforts are now made to determine
|
685
|
+
whether Amazon returned any errors. In particular, batch operations and
|
686
|
+
MultipleOperations may return errors at different locations in the XML tree
|
687
|
+
than normal operations.
|
688
|
+
|
689
|
+
7. A bug that materialised only when using an HTTP proxy has been fixed.
|
690
|
+
|
691
|
+
|
692
|
+
0.2.0 - 2008-04-28
|
693
|
+
------------------
|
694
|
+
|
695
|
+
1. In previous versions, only 5 types of operation were supported:
|
696
|
+
|
697
|
+
BrowseNodeLookup
|
698
|
+
ItemLookup
|
699
|
+
ItemSearch
|
700
|
+
ListSearch
|
701
|
+
SellerListingSearch
|
702
|
+
|
703
|
+
This version supports all remaining non-shopping-cart operations:
|
704
|
+
|
705
|
+
CustomerContentLookup
|
706
|
+
CustomerContentSearch
|
707
|
+
Help
|
708
|
+
ListLookup
|
709
|
+
SellerListingSearch
|
710
|
+
SellerLookup
|
711
|
+
SimilarityLookup
|
712
|
+
TagLookup
|
713
|
+
TransactionLookup
|
714
|
+
|
715
|
+
Examples of each of these can be found in ./examples/
|
716
|
+
|
717
|
+
It is hoped that shopping-carts will make their debut in the next release
|
718
|
+
of Ruby/AWS.
|
719
|
+
|
720
|
+
2. One can now use a Symbol for search indices and hash keys when
|
721
|
+
instantiating operation objects and response group objects.
|
722
|
+
|
723
|
+
For example:
|
724
|
+
|
725
|
+
is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
|
726
|
+
rg = ResponseGroup.new( 'Large' )
|
727
|
+
|
728
|
+
can now be written like this:
|
729
|
+
|
730
|
+
is = ItemSearch.new( :Books, { :Title => 'Ruby' } )
|
731
|
+
rg = ResponseGroup.new( :Large )
|
732
|
+
|
733
|
+
It's up to you which form you use. The Symbol form saves one character. :-)
|
734
|
+
|
735
|
+
3. AWSObject#to_s has been improved to provide something better looking.
|
736
|
+
There's still room for improvement, though.
|
737
|
+
|
738
|
+
4. AWSObject#to_i has been added. This allows, for example, AWSObjects to be
|
739
|
+
used with the %d format specifier in formatted strings. It's up to you,
|
740
|
+
though, to know when an AWSObject can be expected to contain a String
|
741
|
+
that's usable as an Integer.
|
742
|
+
|
743
|
+
5. Objects of a class whose name matches AWSObject::.*Image typically have a
|
744
|
+
@url attribute that points to the URL of the image in question. Such
|
745
|
+
objects now have a #get method, which can be used to retrieve the image in
|
746
|
+
question. This method takes a single parameter, an integer precentage,
|
747
|
+
which causes the retrieved image to be overlayed with a discount icon.
|
748
|
+
|
749
|
+
6. Various compatibility fixes were made to allow Ruby/AWS to work under Ruby
|
750
|
+
1.9. The use of Ruby/AWS with this version is still not recommended,
|
751
|
+
however. For one thing, Ruby 1.9 seems to use #inspect in places that Ruby
|
752
|
+
1.8 used #to_s.
|
753
|
+
|
754
|
+
|
755
|
+
0.1.0 - 2008-04-11
|
756
|
+
------------------
|
757
|
+
|
758
|
+
1. Version 0.1.0 of Ruby/AWS has undergone fundamental changes from the
|
759
|
+
previous, very crude versions, 0.0.1 and 0.0.2.
|
760
|
+
|
761
|
+
For one thing, the AWS XML parser has been completely rewritten. In this
|
762
|
+
new version, classes are dynamically generated as required, based on the
|
763
|
+
elements present in the XML pages returned by AWS.
|
764
|
+
|
765
|
+
Previous versions of Ruby/AWS (and also Ruby/Amazon), manually defined most
|
766
|
+
of these classes, based on Amazon's developer documentation and examination
|
767
|
+
of AWS XML reponses. This time-consuming, unwieldy and unnecessary approach
|
768
|
+
was largely the result of my own lack of aptitude with the Ruby REXML
|
769
|
+
library.
|
770
|
+
|
771
|
+
While these manually defined classes accounted for much of the data
|
772
|
+
returned by AWS, a smaller section of the data was, nevertheless,
|
773
|
+
dynamically converted to Ruby data structures. This mix of manually and
|
774
|
+
automatically treated objects led to inconsistencies in the Ruby
|
775
|
+
representation of the hierarchical XML structure. This meant that it was
|
776
|
+
not quite possible to look at an AWS XML response and reliably determine
|
777
|
+
how the resulting Ruby data structure would look.
|
778
|
+
|
779
|
+
That inconsistency has been ironed out in version 0.1.0. As of now,
|
780
|
+
_everything_ is dynamically generated from the AWS XML response. All manual
|
781
|
+
class definitions have been removed and all classes are now defined at the
|
782
|
+
time they first need to be instantiated.
|
783
|
+
|
784
|
+
This has the following advantages:
|
785
|
+
|
786
|
+
- Changes in the structure of AWS XML responses will not break Ruby/AWS.
|
787
|
+
They may break user code (if, for example, you depend on the presence
|
788
|
+
of a piece of data that later disappears from AWS responses [and even
|
789
|
+
this should not happen, because AWS v4 has a versioned API]), but they
|
790
|
+
will not break the library. The library will always create whichever
|
791
|
+
classes are needed to represent any given XML structure returned by
|
792
|
+
AWS.
|
793
|
+
|
794
|
+
- Changes in the structure of AWS XML that results in new data being
|
795
|
+
included in responses will automatically cause said data to be made
|
796
|
+
available via Ruby/AWS. If, for example, Amazon starts to return data
|
797
|
+
about the duration of each CD in their catalogue, perhaps using a
|
798
|
+
<Duration> tag, foo.duration would automatically start to return that
|
799
|
+
property.
|
800
|
+
|
801
|
+
- It should be faster, but I haven't verified this.
|
802
|
+
|
803
|
+
2. Multiple operations are now supported.
|
804
|
+
|
805
|
+
3. Geolocation of locale is now working.
|
806
|
+
|
807
|
+
4. Documentation in this version has been radically improved, but is still
|
808
|
+
lacking.
|