ruby-aaws 0.4.4 → 0.5.0
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/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/NEWS
CHANGED
@@ -1,382 +1,471 @@
|
|
1
|
-
$Id: NEWS,v 1.
|
2
|
-
|
3
|
-
|
4
|
-
0.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
returns an error -- are now subclasses of AWSError. Previously, they were
|
34
|
-
immediate subclasses of StandardError.
|
1
|
+
$Id: NEWS,v 1.16 2009/02/20 00:37:15 ianmacd Exp $
|
2
|
+
|
3
|
+
|
4
|
+
0.5.0 - 2009-01-20
|
5
|
+
------------------
|
6
|
+
|
7
|
+
1. The configuration files (/etc/amazonrc and typically ~/.amazonrc) are now
|
8
|
+
locale-specific. Global and locale-specific settings can now be placed in
|
9
|
+
their own sections. For example:
|
10
|
+
|
11
|
+
Old style .amazonrc:
|
12
|
+
|
13
|
+
associate = 'caliban-21'
|
14
|
+
locale = 'uk'
|
15
|
+
cache = false
|
16
|
+
key_id = '0Y44V8FAFNM119C6XYZ2'
|
17
|
+
|
18
|
+
New style .amazonrc:
|
19
|
+
|
20
|
+
[global]
|
21
|
+
locale = 'uk'
|
22
|
+
cache = false
|
23
|
+
key_id = '0Y44V8FAFNM119C6XYZ2'
|
24
|
+
|
25
|
+
[uk]
|
26
|
+
associate = 'calibanorg-21'
|
27
|
+
|
28
|
+
[us]
|
29
|
+
associate = 'calibanorg-20'
|
30
|
+
|
31
|
+
|
32
|
+
The old style of configuration is still supported.
|
35
33
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
2. ItemLookup.new and SellerListingLookup.new no longer take a third
|
35
|
+
parameter, b_parameters. Instead, the new Operation#batch method can be
|
36
|
+
used to create batch operations.
|
40
37
|
|
41
|
-
|
42
|
-
|
38
|
+
Operation#batch can batch multiple operations of any class, not just
|
39
|
+
ItemLookup and SellerListingLookup. The only requirement if that all
|
40
|
+
batched operations must be of the same class.
|
43
41
|
|
44
|
-
|
45
|
-
|
42
|
+
If you want to send multiple operations of different classes as a single
|
43
|
+
request, you must still use the MultipleOperation class.
|
46
44
|
|
47
|
-
|
45
|
+
3. VehiclePartLookup, VehiclePartSearch and VehicleSearch operations (which
|
46
|
+
were added in the 2008-08-19 revision of the AWS API, are now supported.
|
47
|
+
However, VehiclePartLookup is the only one of these that currently supports
|
48
|
+
pagination.
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
not nil (nil is the default), this string is read instead of /etc/amazonrc and
|
52
|
-
~/.amazonrc. This addition is really just to aid unit-testing of the
|
53
|
-
Amazon::Config class, as Amazon::Config.new never needs to be called by user
|
54
|
-
code.
|
50
|
+
4. The list of allowable search indices for ItemSearch operations has been
|
51
|
+
updated in accordance with the latest AWS documentation.
|
55
52
|
|
56
|
-
|
53
|
+
5. Parameter checking for ItemSearch operations no longer occurs. It was
|
54
|
+
impractical to keep the list of valid parameters concurrent with AWS.
|
55
|
+
Related constants have therefore also been removed.
|
57
56
|
|
58
|
-
The
|
59
|
-
|
60
|
-
when ALL_PAGES has been requested, but the same approach was attempted for all
|
61
|
-
types of operation.
|
62
|
-
|
63
|
-
Each operation has its own pagination parameter and its own maximum number of
|
64
|
-
pages that can be fetched. This is now stored in the Amazon::AWS::PAGINATION
|
65
|
-
hash.
|
66
|
-
|
67
|
-
Note that ItemLookup has three possible pagination parameters: OfferPage,
|
68
|
-
VariationPage and ReviewPage. Ruby/AWS uses OfferPage for the purposes of
|
69
|
-
ALL_PAGES.
|
70
|
-
|
71
|
-
Operations that do not explicitly provide a pagination parameter (or, at
|
72
|
-
least, those for which there isn't one listed in the AWS Developer's Guide)
|
73
|
-
use ItemPage and pagination up to page 400. This is likely to throw an
|
74
|
-
exception, as such operations almost certainly don't support multiple results
|
75
|
-
pages.
|
57
|
+
6. The version of the AWS API used is now 2009-01-06, the latest at the time
|
58
|
+
of writing.
|
76
59
|
|
60
|
+
The configuration file now supports a new global parameter for requesting a
|
61
|
+
different version of the API. For example:
|
77
62
|
|
78
|
-
|
79
|
-
-----
|
63
|
+
api = '2008-08-19'
|
80
64
|
|
81
|
-
|
82
|
-
|
65
|
+
7. While testing the ability to request a specific version of the AWS API, I
|
66
|
+
encountered a new kind of AWS error, the internal error, which is reported
|
67
|
+
using a different XML construct to that used for all other error
|
68
|
+
conditions.
|
83
69
|
|
84
|
-
|
85
|
-
|
86
|
-
|
70
|
+
I triggered one of these internal errors when I attempted an operation, a
|
71
|
+
VehicleSearch, that did not yet exist in the older version of the API that
|
72
|
+
I requested.
|
87
73
|
|
88
|
-
|
89
|
-
|
90
|
-
|
74
|
+
This type of error now throws a generic Amazon::AWS::Error::AWSError
|
75
|
+
exception.
|
76
|
+
|
77
|
+
It's reasonable to assume that there are other conditions that would cause
|
78
|
+
an internal AWS error to occur. These, too, will be raised as an exception.
|
79
|
+
|
80
|
+
Unfortunately, AWS supplies no information on the cause of such internal
|
81
|
+
errors, so Ruby/AWS is unable to pass on any clues to the user.
|
91
82
|
|
92
|
-
Choose one of these at your convenience.
|
93
83
|
|
94
|
-
|
95
|
-
|
96
|
-
of the gem.
|
84
|
+
0.4.4 - 2008-10-03
|
85
|
+
------------------
|
97
86
|
|
87
|
+
1. It's now possible to have Ruby/AWS use a user configuration file with a
|
88
|
+
name other than .amazonrc. This is achieved by defining $AMAZONRCFILE. If
|
89
|
+
left undefined, the default of .amazonrc is used.
|
98
90
|
|
99
|
-
|
100
|
-
|
91
|
+
2. Locations other than $HOME were not being checked for .amazonrc. This bug
|
92
|
+
has now been fixed.
|
101
93
|
|
102
|
-
The version of the Amazon AWS API requested when performing operations is now
|
103
|
-
2008-06-26. This is the latest at the time of writing.
|
104
94
|
|
105
|
-
|
106
|
-
|
107
|
-
when the original Cart object no longer exists.
|
95
|
+
0.4.3 - 2008-09-22
|
96
|
+
------------------
|
108
97
|
|
109
|
-
|
110
|
-
|
98
|
+
1. $AMAZONRCDIR is now searched for .amazonrc before $HOME and the other
|
99
|
+
directories. This allows a user-defined location to be used for the user
|
100
|
+
configuration file.
|
111
101
|
|
102
|
+
2. There is a new top-level class of exception for Ruby/AWS,
|
103
|
+
Amazon::AmazonError.
|
112
104
|
|
113
|
-
|
114
|
-
|
105
|
+
Most non-operational exceptions, such as Amazon::AWS::HTTPError,
|
106
|
+
Amazon::Config::ConfigError,
|
107
|
+
Amazon::AWS::Search::Request::AccessKeyIdError,
|
108
|
+
Amazon::AWS::Search::Request::LocaleError and
|
109
|
+
Amazon::AWS::ShoppingCart::CartError are now immediate subclasses of
|
110
|
+
AmazonError. Previously, they were subclasses of StandardError.
|
115
111
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
112
|
+
3. Amazon::AWS::Error::AWSError was previously a class that generated
|
113
|
+
exceptions, but it's now simply a container class derived from AmazonError.
|
114
|
+
All operational exceptions -- the ones whose class is dynamically created
|
115
|
+
when AWS returns an error -- are now subclasses of AWSError. Previously,
|
116
|
+
they were immediate subclasses of StandardError.
|
121
117
|
|
122
|
-
|
118
|
+
This has the advantage of allowing all of the exceptions resulting from
|
119
|
+
operational errors to be caught by rescuing just the container class,
|
120
|
+
AWSError.
|
121
|
+
|
123
122
|
|
124
|
-
|
123
|
+
0.4.2 - 2008-09-11
|
124
|
+
------------------
|
125
125
|
|
126
|
-
The
|
127
|
-
|
128
|
-
top level directory of the archive. The gem will be generated and placed in
|
129
|
-
the ./pkg subdirectory, from where you can 'sudo gem install' it.
|
126
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
127
|
+
now 2008-08-19. This is the latest at the time of writing.
|
130
128
|
|
131
|
-
|
132
|
-
|
133
|
-
package with gem's -t option to run the supplied unit tests.
|
129
|
+
2. The exception class Amazon::Config::ConfigError was mysteriously not
|
130
|
+
defined.
|
134
131
|
|
135
|
-
|
132
|
+
3. Amazon::Config.new now accepts an optional argument, config_str, which may
|
133
|
+
contain the string equivalent of a config file's contents. When config_str
|
134
|
+
is not nil (nil is the default), this string is read instead of
|
135
|
+
/etc/amazonrc and ~/.amazonrc. This addition is really just to aid
|
136
|
+
unit-testing of the Amazon::Config class, as Amazon::Config.new never needs
|
137
|
+
to be called by user code.
|
136
138
|
|
137
|
-
|
139
|
+
4. Config file lines may now contain leading whitespace.
|
138
140
|
|
141
|
+
5. The Amazon::AWS::MAX_PAGES constant has gone, replaced by the PAGINATION
|
142
|
+
hash. Only ItemSearch should use ItemPage to page through results up to
|
143
|
+
MAX_PAGES when ALL_PAGES has been requested, but the same approach was
|
144
|
+
attempted for all types of operation.
|
145
|
+
|
146
|
+
Each operation has its own pagination parameter and its own maximum number
|
147
|
+
of pages that can be fetched. This is now stored in the
|
148
|
+
Amazon::AWS::PAGINATION hash.
|
149
|
+
|
150
|
+
Note that ItemLookup has three possible pagination parameters: OfferPage,
|
151
|
+
VariationPage and ReviewPage. Ruby/AWS uses OfferPage for the purposes of
|
152
|
+
ALL_PAGES.
|
153
|
+
|
154
|
+
Operations that do not explicitly provide a pagination parameter (or, at
|
155
|
+
least, those for which there isn't one listed in the AWS Developer's Guide)
|
156
|
+
use ItemPage for pagination up to page 400. In practice, this is likely to
|
157
|
+
throw an exception, as such operations almost certainly don't support
|
158
|
+
multiple results pages.
|
139
159
|
|
140
|
-
0.3.2
|
141
|
-
-----
|
142
160
|
|
143
|
-
|
144
|
-
|
145
|
-
This is because subclasses of Amazon::AWS::AWSObject are created as needed
|
146
|
-
when XML responses from AWS are parsed. Whilst there is no problem dumping
|
147
|
-
objects instantiated from such classes, the difficulty arises when later
|
148
|
-
loading and attempting to reinstantiate them in a new process, because the
|
149
|
-
dynamic classes from which they were spawned no longer exist.
|
161
|
+
0.4.1 - 2008-08-18
|
162
|
+
------------------
|
150
163
|
|
151
|
-
The
|
152
|
-
|
153
|
-
alternatives to Marshal.load and YAML.load, respectively.
|
164
|
+
1. The exception class Amazon::AWS::HTTPError was not actually defined, which
|
165
|
+
caused an error when an attempt was made to raise an instance of it.
|
154
166
|
|
167
|
+
2. If you're using Windows, %HOME% typically isn't defined. Therefore, the
|
168
|
+
following sequence of paths is now searched for your .amazonrc
|
169
|
+
configuration file:
|
155
170
|
|
156
|
-
|
157
|
-
|
171
|
+
%HOME%
|
172
|
+
%HOMEDRIVE% + %HOMEPATH%
|
173
|
+
%USERPROFILE%
|
174
|
+
|
175
|
+
Choose one of these at your convenience.
|
158
176
|
|
159
|
-
|
160
|
-
|
177
|
+
3. The Ruby/AWS gem has been renamed ruby-aaws (from ruby-aws) to avoid a
|
178
|
+
namespace clash with another project. This clash prevented remote
|
179
|
+
installation of the gem.
|
161
180
|
|
162
|
-
The 'Save For Later' area of remote shopping-carts is now implemented.
|
163
181
|
|
164
|
-
|
165
|
-
|
166
|
-
they are moved in the opposite direction.
|
182
|
+
0.4.0 - 2008-07-05
|
183
|
+
------------------
|
167
184
|
|
168
|
-
|
169
|
-
|
170
|
-
claims this can be done to move partial quantities from one area of the cart
|
171
|
-
to the other.
|
185
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
186
|
+
now 2008-06-26. This is the latest at the time of writing.
|
172
187
|
|
173
|
-
|
174
|
-
|
188
|
+
2. A new method, Amazon::AWS::ShoppingCart::Cart#cart_get, has been added, to
|
189
|
+
allow the retrieval of an existing shopping-cart from AWS. This is
|
190
|
+
necessary when the original Cart object no longer exists.
|
175
191
|
|
176
|
-
|
177
|
-
|
178
|
-
@saved_for_later_items is also set to [] by Cart.new.
|
192
|
+
3. A bug in Amazon::AWS::ShoppingCart::Cart#cart_modify has been fixed, which
|
193
|
+
caused carts with no items in their active section to raise an exception.
|
179
194
|
|
180
|
-
Cart#include? now also returns true if the item being queried is in the Save
|
181
|
-
For Later area of the cart. Previously, only the active area was inspected.
|
182
195
|
|
183
|
-
|
184
|
-
|
185
|
-
the item is present, its CartItemId is returned; otherwise 'false'.
|
196
|
+
0.3.3 - 2008-06-23
|
197
|
+
------------------
|
186
198
|
|
187
|
-
|
188
|
-
|
189
|
-
|
199
|
+
1. YAML.aws_load has been removed. Its functionality is available directly
|
200
|
+
from Amazon::AWS::AWSObject.yaml_load and it wasn't logical or necessary to
|
201
|
+
duplicate that in the YAML class itself. There was no corresponding
|
202
|
+
Marshal.aws_load method, but if there had been, that, too, would have been
|
203
|
+
removed.
|
190
204
|
|
191
|
-
|
192
|
-
object may be directly assigned to it, or you may assign the value 'true'. If
|
193
|
-
@cache is set to 'true', a Cache object will automatically be assigned to it
|
194
|
-
the next time @cache is referenced. This is most useful when one wishes to
|
195
|
-
switch from using no cache to using one, or vice versa.
|
205
|
+
2. Ruby/AWS is finally available as a RubyGems package and can be found here:
|
196
206
|
|
197
|
-
|
207
|
+
http://www.caliban.org/files/ruby/ruby-aws-0.3.3.gem
|
198
208
|
|
199
|
-
|
200
|
-
|
209
|
+
The enclosed Rakefile can be used to build the gem from scratch. First make
|
210
|
+
sure you have rake and rubygems installed, and then simply type 'rake' in
|
211
|
+
the top level directory of the archive. The gem will be generated and
|
212
|
+
placed in the ./pkg subdirectory, from where you can 'sudo gem install' it.
|
201
213
|
|
202
|
-
|
203
|
-
|
214
|
+
This is my first gem, so bear with me. It appears to work properly, but I
|
215
|
+
offer no guarantees. One thing that doesn't currently work is installing
|
216
|
+
the package with gem's -t option to run the supplied unit tests.
|
204
217
|
|
205
|
-
|
218
|
+
More information about RubyGems can be found here:
|
206
219
|
|
220
|
+
http://www.rubygems.org/
|
207
221
|
|
208
|
-
0.3.0
|
209
|
-
-----
|
210
222
|
|
211
|
-
|
212
|
-
|
223
|
+
0.3.2 - 2008-06-17
|
224
|
+
------------------
|
213
225
|
|
214
|
-
|
215
|
-
|
216
|
-
|
226
|
+
1. Serialisation, e.g. with Marshal and YAML, has been a problem until now.
|
227
|
+
|
228
|
+
This is because subclasses of Amazon::AWS::AWSObject are created as needed
|
229
|
+
when XML responses from AWS are parsed. Whilst there is no problem dumping
|
230
|
+
objects instantiated from such classes, the difficulty arises when later
|
231
|
+
loading and attempting to reinstantiate them in a new process, because the
|
232
|
+
dynamic classes from which they were spawned no longer exist.
|
217
233
|
|
218
|
-
|
219
|
-
|
220
|
-
|
234
|
+
The solution to the problem comes in the form of the new methods
|
235
|
+
Amazon::AWS::AWSObject.load and Amazon::AWS::AWSObject.yaml_load. Use these
|
236
|
+
as alternatives to Marshal.load and YAML.load, respectively.
|
221
237
|
|
222
|
-
This adds the following AWS operations to the list of those supported:
|
223
238
|
|
224
|
-
|
225
|
-
|
226
|
-
CartModify
|
227
|
-
CartClear
|
239
|
+
0.3.1 - 2008-06-10
|
240
|
+
------------------
|
228
241
|
|
229
|
-
|
230
|
-
|
242
|
+
This release mostly features refinements to the support for remote
|
243
|
+
shopping-carts.
|
231
244
|
|
232
|
-
|
233
|
-
of the cart.
|
245
|
+
1. The 'Save For Later' area of remote shopping-carts is now implemented.
|
234
246
|
|
235
|
-
|
236
|
-
|
247
|
+
Cart#cart_modify now takes an extra parameter, save_for_later. If true,
|
248
|
+
items are moved from the active to the Save For Later area of the cart. If
|
249
|
+
false, they are moved in the opposite direction.
|
237
250
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
251
|
+
In both cases, the quantity parameter is ignored, because attempting to
|
252
|
+
pass it through to AWS results in an error, even though the AWS
|
253
|
+
documentation claims this can be done to move partial quantities from one
|
254
|
+
area of the cart to the other.
|
242
255
|
|
243
|
-
|
244
|
-
|
245
|
-
of interest to the user.
|
256
|
+
2. Cart objects now have a @saved_for_later_items attribute, aliased to
|
257
|
+
@saved_items and @saved for brevity. Take your pick.
|
246
258
|
|
247
|
-
|
248
|
-
|
249
|
-
|
259
|
+
3. @cart_items is now set to [] when Cart.new is called. Previously, it wasn't
|
260
|
+
set until Cart#cart_create was used, at which time it was set to nil.
|
261
|
+
@saved_for_later_items is also set to [] by Cart.new.
|
250
262
|
|
251
|
-
|
263
|
+
4. Cart#include? now also returns true if the item being queried is in the
|
264
|
+
Save For Later area of the cart. Previously, only the active area was
|
265
|
+
inspected.
|
252
266
|
|
253
|
-
|
267
|
+
5. New methods, Cart#active? and Cart#saved_for_later? (alias Cart#saved?),
|
268
|
+
return whether or not an item is present in a particular area of the cart.
|
269
|
+
If the item is present, its CartItemId is returned; otherwise 'false'.
|
254
270
|
|
255
|
-
|
271
|
+
6. A bug that caused shopping-cart transactions to use the cache if one was
|
272
|
+
requested has been fixed. Shopping-carts should never use the cache under
|
273
|
+
any circumstances.
|
256
274
|
|
257
|
-
|
258
|
-
|
259
|
-
|
275
|
+
7. Request objects can now have their @cache attribute assigned to. A Cache
|
276
|
+
object may be directly assigned to it, or you may assign the value 'true'.
|
277
|
+
If @cache is set to 'true', a Cache object will automatically be assigned
|
278
|
+
to it the next time @cache is referenced. This is most useful when one
|
279
|
+
wishes to switch from using no cache to using one, or vice versa.
|
260
280
|
|
261
|
-
|
262
|
-
Amazon returned any errors. In particular, batch operations and
|
263
|
-
MultipleOperations may return errors at different locations in the XML tree
|
264
|
-
than normal operations.
|
281
|
+
8. Cache#flush_expired invariably threw an exception. This bug has been fixed.
|
265
282
|
|
266
|
-
|
283
|
+
9. Geolocation of users by host and IP address now raises an
|
284
|
+
Amazon::Locale::GeoError exception if the host or IP address is
|
285
|
+
unresolvable.
|
267
286
|
|
287
|
+
There's a new Ruby/AWS mailing-list for discussion of the development and
|
288
|
+
usage of this library:
|
268
289
|
|
269
|
-
|
270
|
-
-----
|
290
|
+
http://www.caliban.org/mailman/listinfo/ruby-aws
|
271
291
|
|
272
|
-
In previous versions, only 5 types of operation were supported:
|
273
292
|
|
274
|
-
|
275
|
-
|
276
|
-
ItemSearch
|
277
|
-
ListSearch
|
278
|
-
SellerListingSearch
|
293
|
+
0.3.0 - 2008-05-19
|
294
|
+
------------------
|
279
295
|
|
280
|
-
|
296
|
+
1. The version of the Amazon AWS API requested when performing operations is
|
297
|
+
now 2008-04-07. This is the latest at the time of writing.
|
281
298
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
ListLookup
|
286
|
-
SellerListingSearch
|
287
|
-
SellerLookup
|
288
|
-
SimilarityLookup
|
289
|
-
TagLookup
|
290
|
-
TransactionLookup
|
299
|
+
2. Remote shopping-carts are now implemented. See the
|
300
|
+
Amazon::AWS::ShoppingCart module and the Amazon::AWS::ShoppingCart::Cart
|
301
|
+
class in ./amazon/aws/shoppingcart.rb for more details.
|
291
302
|
|
292
|
-
|
303
|
+
Basically, the new methods are Cart.new, Cart#cart_create, Cart#cart_add,
|
304
|
+
Cart#cart_modify and Cart#cart_clear. There's also Cart#each for iterating
|
305
|
+
over the items in a cart.
|
293
306
|
|
294
|
-
|
295
|
-
Ruby/AWS.
|
307
|
+
This adds the following AWS operations to the list of those supported:
|
296
308
|
|
297
|
-
|
298
|
-
|
309
|
+
CartCreate
|
310
|
+
CartAdd
|
311
|
+
CartModify
|
312
|
+
CartClear
|
299
313
|
|
300
|
-
|
314
|
+
It's currently not possible to update a wishlist at purchase time by
|
315
|
+
referring to the item's ListItemId when adding it to a cart.
|
301
316
|
|
302
|
-
|
303
|
-
|
317
|
+
It's also currently not possible to add items to the 'Saved For Later'
|
318
|
+
section of the cart.
|
304
319
|
|
305
|
-
|
320
|
+
3. A new iterator method, AWSObject#each, yields each |property, value| of the
|
321
|
+
AWSObject.
|
306
322
|
|
307
|
-
|
308
|
-
|
323
|
+
4. The AWSObject and AWSArray classes have received a few new helper methods
|
324
|
+
that should make AWSObject and single element AWSArray objects behave more
|
325
|
+
akin to strings when they are being compared with strings, matched against
|
326
|
+
regexes, etc.
|
309
327
|
|
310
|
-
|
328
|
+
5. An otherwise undocumented method, AWSObject#kernel, provides unnested (i.e.
|
329
|
+
top level) AWSObject objects with a shortcut reference to the data most
|
330
|
+
likely of interest to the user.
|
311
331
|
|
312
|
-
|
313
|
-
|
332
|
+
For example, if a top level AWSObject is formed as the result of an
|
333
|
+
ItemSearch, one might normally refer to the items returned with something
|
334
|
+
like this:
|
314
335
|
|
315
|
-
|
316
|
-
with the %d format specifier in formatted strings. It's up to you, though, to
|
317
|
-
know when an AWSObject can be expected to contain a String that's usable as an
|
318
|
-
Integer.
|
336
|
+
foo.item_search_response[0].items[0].item
|
319
337
|
|
320
|
-
|
321
|
-
attribute that points to the URL of the image in question. Such objects now
|
322
|
-
have a #get method, which can be used to retrieve the image in question. This
|
323
|
-
method takes a single parameter, an integer precentage, which causes the
|
324
|
-
retrieved image to be overlayed with a discount icon.
|
338
|
+
AWSObject#kernel allows the same data to be referred to as follows:
|
325
339
|
|
326
|
-
|
327
|
-
1.9. The use of Ruby/AWS with this version is still not recommended, however.
|
328
|
-
For one thing, Ruby 1.9 seems to use #inspect in places that Ruby 1.8 used
|
329
|
-
#to_s.
|
340
|
+
foo.kernel
|
330
341
|
|
342
|
+
The path to the data is programatically determined, so this method only
|
343
|
+
works for top level AWSObject objects created by a class of operation whose
|
344
|
+
name can be used to derive the path. This is why this method is not
|
345
|
+
mentioned in the RDoc documentation.
|
331
346
|
|
332
|
-
|
333
|
-
|
347
|
+
6. When searches are performed, greater efforts are now made to determine
|
348
|
+
whether Amazon returned any errors. In particular, batch operations and
|
349
|
+
MultipleOperations may return errors at different locations in the XML tree
|
350
|
+
than normal operations.
|
334
351
|
|
335
|
-
|
336
|
-
very crude versions, 0.0.1 and 0.0.2.
|
352
|
+
7. A bug that materialised only when using an HTTP proxy has been fixed.
|
337
353
|
|
338
|
-
For one thing, the AWS XML parser has been completely rewritten. In this new
|
339
|
-
version, classes are dynamically generated as required, based on the elements
|
340
|
-
present in the XML pages returned by AWS.
|
341
354
|
|
342
|
-
|
343
|
-
|
344
|
-
AWS XML reponses. This time-consuming, unwieldy and unnecessary approach was
|
345
|
-
largely the result of my own lack of aptitude with the Ruby REXML library.
|
355
|
+
0.2.0 - 2008-04-28
|
356
|
+
------------------
|
346
357
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
358
|
+
1. In previous versions, only 5 types of operation were supported:
|
359
|
+
|
360
|
+
BrowseNodeLookup
|
361
|
+
ItemLookup
|
362
|
+
ItemSearch
|
363
|
+
ListSearch
|
364
|
+
SellerListingSearch
|
365
|
+
|
366
|
+
This version supports all remaining non-shopping-cart operations:
|
367
|
+
|
368
|
+
CustomerContentLookup
|
369
|
+
CustomerContentSearch
|
370
|
+
Help
|
371
|
+
ListLookup
|
372
|
+
SellerListingSearch
|
373
|
+
SellerLookup
|
374
|
+
SimilarityLookup
|
375
|
+
TagLookup
|
376
|
+
TransactionLookup
|
377
|
+
|
378
|
+
Examples of each of these can be found in ./examples/
|
379
|
+
|
380
|
+
It is hoped that shopping-carts will make their debut in the next release
|
381
|
+
of Ruby/AWS.
|
354
382
|
|
355
|
-
|
356
|
-
|
357
|
-
class definitions have been removed and all classes are now defined at the
|
358
|
-
time they first need to be instantiated.
|
383
|
+
2. One can now use a Symbol for search indices and hash keys when
|
384
|
+
instantiating operation objects and response group objects.
|
359
385
|
|
360
|
-
|
386
|
+
For example:
|
361
387
|
|
362
|
-
|
363
|
-
|
364
|
-
of data that later disappears from AWS responses [and even this should not
|
365
|
-
happen, because AWS v4 has a versioned API]), but they will not break the
|
366
|
-
library. The library will always create whichever classes are needed to
|
367
|
-
represent any given XML structure returned by AWS.
|
388
|
+
is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
|
389
|
+
rg = ResponseGroup.new( 'Large' )
|
368
390
|
|
369
|
-
|
370
|
-
included in responses will automatically cause said data to be made
|
371
|
-
available via Ruby/AWS. If, for example, Amazon starts to return data about
|
372
|
-
the duration of each CD in their catalogue, perhaps using a <Duration> tag,
|
373
|
-
foo.duration would automatically start to return that property.
|
391
|
+
can now be written like this:
|
374
392
|
|
375
|
-
|
393
|
+
is = ItemSearch.new( :Books, { :Title => 'Ruby' } )
|
394
|
+
rg = ResponseGroup.new( :Large )
|
376
395
|
|
377
|
-
|
396
|
+
It's up to you which form you use. The Symbol form saves one character. :-)
|
378
397
|
|
379
|
-
|
398
|
+
3. AWSObject#to_s has been improved to provide something better looking.
|
399
|
+
There's still room for improvement, though.
|
400
|
+
|
401
|
+
4. AWSObject#to_i has been added. This allows, for example, AWSObjects to be
|
402
|
+
used with the %d format specifier in formatted strings. It's up to you,
|
403
|
+
though, to know when an AWSObject can be expected to contain a String
|
404
|
+
that's usable as an Integer.
|
380
405
|
|
381
|
-
|
382
|
-
|
406
|
+
5. Objects of a class whose name matches AWSObject::.*Image typically have a
|
407
|
+
@url attribute that points to the URL of the image in question. Such
|
408
|
+
objects now have a #get method, which can be used to retrieve the image in
|
409
|
+
question. This method takes a single parameter, an integer precentage,
|
410
|
+
which causes the retrieved image to be overlayed with a discount icon.
|
411
|
+
|
412
|
+
6. Various compatibility fixes were made to allow Ruby/AWS to work under Ruby
|
413
|
+
1.9. The use of Ruby/AWS with this version is still not recommended,
|
414
|
+
however. For one thing, Ruby 1.9 seems to use #inspect in places that Ruby
|
415
|
+
1.8 used #to_s.
|
416
|
+
|
417
|
+
|
418
|
+
0.1.0 - 2008-04-11
|
419
|
+
------------------
|
420
|
+
|
421
|
+
1. Version 0.1.0 of Ruby/AWS has undergone fundamental changes from the
|
422
|
+
previous, very crude versions, 0.0.1 and 0.0.2.
|
423
|
+
|
424
|
+
For one thing, the AWS XML parser has been completely rewritten. In this
|
425
|
+
new version, classes are dynamically generated as required, based on the
|
426
|
+
elements present in the XML pages returned by AWS.
|
427
|
+
|
428
|
+
Previous versions of Ruby/AWS (and also Ruby/Amazon), manually defined most
|
429
|
+
of these classes, based on Amazon's developer documentation and examination
|
430
|
+
of AWS XML reponses. This time-consuming, unwieldy and unnecessary approach
|
431
|
+
was largely the result of my own lack of aptitude with the Ruby REXML
|
432
|
+
library.
|
433
|
+
|
434
|
+
While these manually defined classes accounted for much of the data
|
435
|
+
returned by AWS, a smaller section of the data was, nevertheless,
|
436
|
+
dynamically converted to Ruby data structures. This mix of manually and
|
437
|
+
automatically treated objects led to inconsistencies in the Ruby
|
438
|
+
representation of the hierarchical XML structure. This meant that it was
|
439
|
+
not quite possible to look at an AWS XML response and reliably determine
|
440
|
+
how the resulting Ruby data structure would look.
|
441
|
+
|
442
|
+
That inconsistency has been ironed out in version 0.1.0. As of now,
|
443
|
+
_everything_ is dynamically generated from the AWS XML response. All manual
|
444
|
+
class definitions have been removed and all classes are now defined at the
|
445
|
+
time they first need to be instantiated.
|
446
|
+
|
447
|
+
This has the following advantages:
|
448
|
+
|
449
|
+
- Changes in the structure of AWS XML responses will not break Ruby/AWS.
|
450
|
+
They may break user code (if, for example, you depend on the presence
|
451
|
+
of a piece of data that later disappears from AWS responses [and even
|
452
|
+
this should not happen, because AWS v4 has a versioned API]), but they
|
453
|
+
will not break the library. The library will always create whichever
|
454
|
+
classes are needed to represent any given XML structure returned by
|
455
|
+
AWS.
|
456
|
+
|
457
|
+
- Changes in the structure of AWS XML that results in new data being
|
458
|
+
included in responses will automatically cause said data to be made
|
459
|
+
available via Ruby/AWS. If, for example, Amazon starts to return data
|
460
|
+
about the duration of each CD in their catalogue, perhaps using a
|
461
|
+
<Duration> tag, foo.duration would automatically start to return that
|
462
|
+
property.
|
463
|
+
|
464
|
+
- It should be faster, but I haven't verified this.
|
465
|
+
|
466
|
+
2. Multiple operations are now supported.
|
467
|
+
|
468
|
+
3. Geolocation of locale is now working.
|
469
|
+
|
470
|
+
4. Documentation in this version has been radically improved, but is still
|
471
|
+
lacking.
|