kernow-ruby-aaws 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README ADDED
@@ -0,0 +1,566 @@
1
+ $Id: README,v 1.17 2008/10/03 12:00:19 ianmacd Exp $
2
+
3
+
4
+ Introduction
5
+ ------------
6
+
7
+ Ruby/AWS is a Ruby language library that makes it relatively easy for the
8
+ programmer to retrieve information from the popular Amazon Web site via
9
+ Amazon's Associates Web Services (AWS). In addition to the original amazon.com
10
+ site, the local sites amazon.co.uk, amazon.de, amazon.fr, amazon.ca and
11
+ amazon.co.jp are also supported.
12
+
13
+ Development of Ruby/AWS has been quite swift since the appearance of the first
14
+ alpha version, 0.0.1, in late March 2008. Although Ruby/AWS shares almost no
15
+ code with its now obsolete predecessor, Ruby/Amazon, many lessons were learnt
16
+ whilst developing that library, and the experience gained has been rolled into
17
+ Ruby/AWS.
18
+
19
+ As of version 0.3.0, I believe that Ruby/AWS has attained its goal of being
20
+ superior to the final version of Ruby/Amazon, 0.9.2, which was released in
21
+ August 2006.
22
+
23
+
24
+ History and compatibility with Ruby/Amazon
25
+ ------------------------------------------
26
+
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 2004. That
29
+ version of the Amazon API was known at the time as AWS 3.x.
30
+
31
+ Amazon later renamed AWS to ECS, or E-Commerce Service, for the launch of
32
+ version 4 of the API, a complete overhaul that provided no backward
33
+ compatibility with previous versions. The previous version of the API was
34
+ thenceforth sometimes referred to as ECS 3.
35
+
36
+ Demonstrating the wisdom and consistency for which large companies are
37
+ globally revered, Amazon changed its mind once again in late 2007, reverting
38
+ to the familiar name of AWS. This time, however, it was said to stand for
39
+ Associates Web Service.
40
+
41
+ Since Amazon started offering AWS, the number of Amazon Web APIs has grown.
42
+ AWS is now just one of many. It is therefore no longer appropriate to call
43
+ this library by a name so general as Ruby/Amazon, because it interfaces only
44
+ with AWS. Therefore, the library will be known henceforth as Ruby/AWS.
45
+
46
+ Ruby/AWS is built around version 4 of the Amazon AWS API, which is
47
+ fundamentally different to version 3, both in terms of how requests are made
48
+ and data returned. The underlying structure of the XML response is radically
49
+ changed from previous versions.
50
+
51
+ It has therefore not been possible in Ruby/AWS to retain any level of API
52
+ 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
+
55
+ One small piece of good news is that the /etc/amazonrc and ~/.amazonrc files
56
+ used with Ruby/Amazon _are_ compatible with Ruby/AWS. The only change required
57
+ for Ruby/AWS is the addition of a 'key_id' parameter, which should contain
58
+ your AWS Access Key ID.
59
+
60
+ Amazon finally decomissioned v3 of the AWS API on 2008-03-31. As a result, the
61
+ original Ruby/Amazon library no longer functions.
62
+
63
+
64
+ AWS Access Key ID
65
+ -----------------
66
+
67
+ You can obtain an AWS Access Key ID here:
68
+
69
+ https://aws-portal.amazon.com/gp/aws/developer/registration/index.html
70
+
71
+ Subscription IDs are deprecated by Amazon and, in any case, not supported by
72
+ Ruby/AWS. Please obtain and use an AWS Access Key ID instead.
73
+
74
+
75
+ API version
76
+ -----------
77
+
78
+ Ruby/AWS currently requests the 2008-06-26 revision of the AWS API when
79
+ performing its operations:
80
+
81
+ http://docs.amazonwebservices.com/AWSECommerceService/2008-03-03/DG/
82
+
83
+
84
+ Status and functionality
85
+ ------------------------
86
+
87
+ Ruby/AWS is currently alpha code. Amongst other things, this means:
88
+
89
+ - You will probably encounter _many_ bugs. You will certainly encounter a few.
90
+ If you tell me about them, I will endeavour to fix them.
91
+
92
+ - The documentation is incomplete, but steadily getting better. Version 0.0.1
93
+ had virtually none, so consider yourself lucky.
94
+
95
+ - Not all features are currently implemented. Others may not be _fully_
96
+ implemented. Yet others may not be _properly_ implemented.
97
+
98
+ Nevertheless, the AWS v4 API is now more or less fully supported, with only
99
+ tiny gaps in the functionality of some operations.
100
+
101
+ Currently implemented operations are:
102
+
103
+ BrowseNodeLookup
104
+ CustomerContentLookup
105
+ CustomerContentSearch
106
+ Help
107
+ ItemLookup
108
+ ItemSearch
109
+ ListLookup
110
+ ListSearch
111
+ SellerListingLookup
112
+ SellerListingSearch
113
+ SellerLookup
114
+ SimilarityLookup
115
+ TagLookup
116
+ TransactionLookup
117
+
118
+ Remote shopping-carts are also implemented as of version 0.3.0. The
119
+ following remote shopping-cart operations are supported:
120
+
121
+ CartCreate
122
+ CartAdd
123
+ CartModify
124
+ CartClear
125
+
126
+ Version 0.4.0 also adds:
127
+
128
+ CartGet
129
+
130
+ Multiple operations and batch requests are also supported, but not well
131
+ tested. Beware of bugs. There appear to also be (undocumented)
132
+ Amazon-imposed restrictions on the use of multiple operations and batch
133
+ requests, so some experimentation on your part will probably be required to
134
+ determine what works and what doesn't.
135
+
136
+ - Classes, methods, constants and instance variables may change name in the
137
+ future. These various objects may appear from nowhere, change shape, grow,
138
+ shrink or disappear entirely. Indeed, this has already happened once in the
139
+ evolution from version 0.0.2 to version 0.1.0, breaking existing code in the
140
+ process.
141
+
142
+ In short, code written to work with this release of Ruby/AWS may stop working
143
+ when you upgrade to the next release. In fact, it may even stop working
144
+ _during_ this release, because it's possible there are circumstances that
145
+ would cause an exception to be raised, that I haven't come across in my
146
+ limited testing of the code.
147
+
148
+ That said, the Ruby/AWS's API is pretty stable at this point in time. I won't
149
+ break any of the method interfaces without seriously considering the merits of
150
+ doing so.
151
+
152
+
153
+ Installation
154
+ ------------
155
+
156
+ Please see the INSTALL file for details of how to install Ruby/AWS. You can
157
+ choose between an installation script and a RubyGems installation.
158
+
159
+
160
+ Usage
161
+ -----
162
+
163
+ First of all, create either /etc/amazonrc or ~/.amazonrc. Its contents should
164
+ look something like this:
165
+
166
+ key_id = '0Y44V8G41KCQPGF6PTR2'
167
+ associate = 'fuzbarorg-21'
168
+ locale = 'uk'
169
+ cache = false
170
+
171
+ Because you're embedding your key ID in the file, you should protect it (on
172
+ UNIX and equivalent systems) by making it mode 0600:
173
+
174
+ $ chmod 600 ~/.amazonrc
175
+
176
+ If you define 'cache' to be 'true', you may also define 'cache_dir' to point
177
+ to somewhere other the default, /tmp/amazon.
178
+
179
+ If you want to place .amazonrc somewhere other than $HOME, you may set
180
+ $AMAZONRCDIR in the environment, as this location is checked prior to $HOME.
181
+
182
+ If you're using Windows, $HOME is usually undefined, so a number of additional
183
+ locations are checked for .amazonrc.
184
+
185
+ The exact search order is as follows:
186
+
187
+ $AMAZONRCDIR
188
+ $HOME
189
+ $HOMEDRIVE + $HOMEPATH
190
+ $USERPROFILE
191
+
192
+ Note that only the first defined location is used, so if, for example, both
193
+ $AMAZONRCDIR and $HOME are defined, but only the path specified by $HOME
194
+ contains a file called .amazonrc, it will not be found.
195
+
196
+ If you want the user configuration file to be called something other than
197
+ .amazonrc, you may define $AMAZONRCFILE in the environment.
198
+
199
+ Once you have your configuration file, you can get started on your code.
200
+
201
+ Here's some basic code, indicating how to perform an ItemSearch, probably the
202
+ most common type of AWS operation. Please see the ./examples subdirectory for
203
+ more examples of working code.
204
+
205
+ --
206
+
207
+ require 'amazon/aws/search'
208
+
209
+ # Avoid having to fully qualify our methods.
210
+ #
211
+ include Amazon::AWS
212
+ include Amazon::AWS::Search
213
+
214
+ is = ItemSearch.new( 'Books', { 'Title' => 'Ruby' } )
215
+
216
+ # I want to receive just a small amount of data for the items found.
217
+ #
218
+ rg = ResponseGroup.new( 'Small' )
219
+
220
+ req = Request.new
221
+
222
+ # Make sure I'm talking to amazon.co.uk.
223
+ #
224
+ req.locale = 'uk'
225
+
226
+ # Actually talk to AWS.
227
+ #
228
+ resp = req.search( is, rg )
229
+
230
+ # Drill down to the meat: the array of items returned.
231
+ #
232
+ items = resp.item_search_response[0].items[0].item
233
+
234
+ # The following alternative shorthand would also have worked:
235
+ #
236
+ # items = resp.item_search_response.items.item
237
+
238
+ # Available properties for first item:
239
+ #
240
+ puts items[0].properties
241
+
242
+ items.each do |item|
243
+ attribs = item.item_attributes[0]
244
+ puts attribs.label
245
+ if attribs.list_price
246
+ puts attribs.title, attribs.list_price[0].formatted_price, ''
247
+ end
248
+ end
249
+
250
+
251
+ XML to Ruby mapping
252
+ -------------------
253
+
254
+ Here, I will discuss the mapping of the XML returned from AWS to native Ruby
255
+ objects and data.
256
+
257
+ When the following code:
258
+
259
+ resp = req.search( is, rg )
260
+
261
+ was called in the previous section, the following URL was composed and sent to
262
+ AWS as an HTTP GET operation:
263
+
264
+ http://ecs.amazonaws.co.uk/onca/xml?AWSAccessKeyId=01234567890123456789&AssociateTag=calibanorg-21&Operation=ItemSearch&ResponseGroup=Small&SearchIndex=Books&Service=AWSECommerceService&Title=Ruby&Version=2008-03-03
265
+
266
+ The following (truncated) AWS XML response was received:
267
+
268
+ <ItemSearchResponse>
269
+ <OperationRequest>
270
+ <HTTPHeaders>
271
+ <Header Name="UserAgent" Value="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080325 Fedora/2.0.0.13-1.fc7 Firefox/2.0.0.13"/>
272
+ </HTTPHeaders>
273
+ <RequestId>1TBGEZ48MF8KZ8TGXH65</RequestId>
274
+ <Arguments>
275
+ <Argument Name="SearchIndex" Value="Books"/>
276
+ <Argument Name="Service" Value="AWSECommerceService"/>
277
+ <Argument Name="ResponseGroup" Value="Small"/>
278
+ <Argument Name="Operation" Value="ItemSearch"/>
279
+ <Argument Name="Version" Value="2008-03-03"/>
280
+ <Argument Name="AssociateTag" Value="calibanorg-21"/>
281
+ <Argument Name="Title" Value="Ruby"/>
282
+ <Argument Name="AWSAccessKeyId" Value="01234567890123456789"/>
283
+ </Arguments>
284
+ <RequestProcessingTime>0.0671439170837402</RequestProcessingTime>
285
+ </OperationRequest>
286
+ <Items>
287
+ <Request>
288
+ <IsValid>True</IsValid>
289
+ <ItemSearchRequest>
290
+ <ResponseGroup>Small</ResponseGroup>
291
+ <SearchIndex>Books</SearchIndex>
292
+ <Title>Ruby</Title>
293
+ </ItemSearchRequest>
294
+ </Request>
295
+ <TotalResults>1804</TotalResults>
296
+ <TotalPages>181</TotalPages>
297
+ <Item>
298
+ <ASIN>0439943663</ASIN>
299
+ <DetailPageURL>
300
+ http://www.amazon.co.uk/gp/redirect.html%3FASIN=0439943663%26tag=calibanorg-21%26lcode=xm2%26cID=2025%26ccmID=165953%26location=/o/ASIN/0439943663%253FSubscriptionId=0Y44V8FAFNM119C6PTR2
301
+ </DetailPageURL>
302
+ <ItemAttributes>
303
+ <Author>Philip Pullman</Author>
304
+ <Manufacturer>Scholastic</Manufacturer>
305
+ <ProductGroup>Book</ProductGroup>
306
+ <Title>The Ruby in the Smoke (Sally Lockhart Quartet)</Title>
307
+ </ItemAttributes>
308
+ </Item>
309
+ <Item>
310
+ <ASIN>0596516177</ASIN>
311
+ ...
312
+
313
+ In Ruby/AWS, each unique XML element name forms a class of the same name. All
314
+ such classes are subclasses of AWSObject. For example, OperationRequest is a
315
+ class, as is ItemAttributes.
316
+
317
+ As the XML tree is traversed, each element is converted to an instance of the
318
+ class of the same name. Every such object has instance variables, one per
319
+ unique child element name. The name of the instance variable is translated to
320
+ comply with Ruby convention by adding an underscore ('_') character at word
321
+ boundaries and converting the name to lower case.
322
+
323
+ For example, given the following XML:
324
+
325
+ <ItemAttributes>
326
+ <Author>Philip Pullman</Author>
327
+ <Manufacturer>Scholastic</Manufacturer>
328
+ <ProductGroup>Book</ProductGroup>
329
+ <Title>The Ruby in the Smoke (Sally Lockhart Quartet)</Title>
330
+ </ItemAttributes>
331
+
332
+ the following statements would all be true:
333
+
334
+ - ItemAttributes, Author, Manufacturer, ProductGroup and Title would all be
335
+ dynamically defined subclasses of AWSObject.
336
+
337
+ - An instance of the ItemAttributes class would be instantiated, with instance
338
+ variables @author, @manufacturer, @product_group and @title.
339
+
340
+ - To each of these instance variables would respectively be assigned an array
341
+ of Author objects, an array of Manufacturer objects, an array of
342
+ ProductGroup objects and an array of Title objects. In the above case, these
343
+ would all be single element arrays, because there's only one instance of
344
+ each kind of tag in the XML.
345
+
346
+ - These lowest level objects would have no instance variables, because the
347
+ corresponding XML elements contain no children, just a value. These objects
348
+ are therefore directly assigned the value of the corresponding XML element.
349
+
350
+ So, if resp is the top level AWSObject created and returned by calling
351
+ Amazon::AWS::Search::Request#search on the Request object, and we'd like to
352
+ know the ASIN of the first item found, we can refer to this as follows:
353
+
354
+ resp.item_search_response[0].items[0].item[0].asin
355
+
356
+ Looking at each component of this chain in turn:
357
+
358
+ - resp is an AWSObject with a single instance variable, @item_search_response.
359
+ This is because the entire XML response is contained within a single
360
+ <ItemSearchResponse> tag pair, so there's nothing else at the top level.
361
+
362
+ - resp.item_search_response is assigned an array of ItemSearchResponse
363
+ objects. Because there's only a single <ItemSearchResponse> tag pair in the
364
+ whole document (containing the rest of the XML), the array contains only a
365
+ single element.
366
+
367
+ - resp.item_search_response[0] has an instance variable, @items, which is
368
+ assigned an array of Items objects. Here again, only a single element is
369
+ created, because there's only one <Items> tag pair in the XML.
370
+
371
+ - resp.item_search_response[0].items[0] has an instance variable, @item, which
372
+ is an array containing the item(s) returned by the search. It is a
373
+ multi-element array, however, because more than one item was found, as
374
+ represented by the multiple <Item> elements in the XML.
375
+
376
+ The creation of so many single element arrays is unfortunate. It makes user
377
+ code verboser, uglier and consequently harder to read.
378
+
379
+ Some such arrays do, in fact, have the potential to be multi-element, because
380
+ the corresponding XML tag _can_ appear multiple times in the AWS response. A
381
+ book, for example, _may_ have more than one <Author>. Many other types of
382
+ array, however, are necessarily single element arrays. The same book, for
383
+ example, is unlikely to have more than one <Title>.
384
+
385
+ As another concrete example, an ItemSearch will probably return many <Item>
386
+ elements in the <ItemSearchResponse>, but these will invariably be nested in a
387
+ single <Items> tag. The @items instance variable of the ItemSearchResponse
388
+ object will therefore always have a size of 1.
389
+
390
+ In other words, the following statements are always true when an ItemSearch
391
+ successfully finds items:
392
+
393
+ - resp.item_search_response[0].items.size == 1
394
+
395
+ - resp.item_search_response[0].items[0].item.size >= 1
396
+
397
+ The awkwardness of using such single element arrays is alleviated in Ruby/AWS
398
+ by the use of the AWSArray subclass. This ever-so-slightly magic class of
399
+ array allows element 0 of single-element arrays to be dereferenced using the
400
+ base array name, i.e. without a subscript.
401
+
402
+ In other words, a reference to foo.bar will actually return foo[0].bar, so
403
+ long as foo.size == 1. Note that this only works because the array instance
404
+ itself, foo, has no bar method, so the intention is unambiguous and foo can
405
+ pass the call of bar down to foo[0]. foo.size, on the other hand, will
406
+ _always_ refer to foo and never to foo[0], because Array#size _is_ an existing
407
+ method.
408
+
409
+ This allows the ASIN of the first item returned in the above XML to be
410
+ referred to using the following shorthand:
411
+
412
+ resp.item_search_response.items.item[0].asin
413
+
414
+ It's worth reiterating that it's still necessary to refer to item[0] using a
415
+ subscript in this example, because the <Items> tag in the XML contains
416
+ multiple <Item> tags, making item.size > 1.
417
+
418
+ Use this syntactic shorthand to your advantage, but understand when you're
419
+ likely to be dealing with a single element array and when a multiple. This
420
+ will become apparent as you gain familiarity with AWS v4.
421
+
422
+ An exception will be thrown if an unknown method is called on a multi-element
423
+ array, as it can't be known which element the method invocation should be
424
+ passed to. This will almost certainly be the result of an incorrect assumption
425
+ that an array contains only a single element when it actually contains
426
+ multiple.
427
+
428
+ A further important detail to note is that not all AWS operations in the same
429
+ class return the same data. For example, an ItemSearch using the Books search
430
+ index will return items that, amongst other things, create an ItemAttributes
431
+ object containing further objects of class Author, ISBN, etc. An ItemSearch
432
+ using the DVD search index, however, will have no Author or ISBN, but _will_
433
+ have a Director and probably one or more Actor objects.
434
+
435
+ Because of the disparity in same-class object attributes, Ruby/AWS returns
436
+ *nil* when an attempt is made to dereference a non-existent instance variable.
437
+ This approach was chosen, because it often cannot be known in advance
438
+ precisely which data will be returned by a given search. Returning *nil* for
439
+ non-existent attributes means that the user does not have to pepper their code
440
+ with exception-handling clauses.
441
+
442
+ For example:
443
+
444
+ resp.item_search_response[0].items[0].item[0].item_attributes.director
445
+
446
+ will return *nil* for a book, because there was no corresponding Director
447
+ element in the XML returned by AWS.
448
+
449
+ Similarly:
450
+
451
+ resp.item_search_response[0].items[0].item[0].item_attributes.foo_bar
452
+
453
+ will _always_ return *nil* for any item, because no kind of ItemSearch will
454
+ ever yield an item with a FooBar attribute.
455
+
456
+
457
+ Parameter checking
458
+ ------------------
459
+
460
+ There are many combinations of parameters and values that are legal for a
461
+ particular type of search. For example, an ItemSearch can use a Sort parameter
462
+ with a value of 'titlerank' if the SearchIndex is 'Books'. However, this value
463
+ wouldn't make much sense in the 'Automotive' SearchIndex.
464
+
465
+ The very presence of a certain parameter can be illegal in a certain contexts.
466
+ For example, specifying the parameter 'Author' with any value would be
467
+ nonsensical in the 'PetSupplies' SearchIndex.
468
+
469
+ To complicate things further, the validity of parameters and their values
470
+ differs not only by search type, but also by Amazon locale (amazon.com,
471
+ amazon.co.uk, amazon.de, etc.) and is prone to change with each minor revision
472
+ of the Amazon AWS API.
473
+
474
+ Even worse, even the operations themselves can be illegal in some locales.
475
+ TransactionLookup operations, for example, don't currently work in the UK
476
+ locale, but do work in the US locale.
477
+
478
+ Ruby/Amazon attempted to track these complex and dynamic relationships to
479
+ prevent illegal or ineffective operations from being attempted. It was a
480
+ time-consuming and tedious task to track the evolving API (which often changed
481
+ in subtle ways without prior [or even belated] notice from Amazon), find all
482
+ of the corner cases and handle undocumented quirks.
483
+
484
+ With the highly dynamic nature of the Amazon environment, plus the sheer
485
+ number of operations, parameters, possible legal values and locales in the AWS
486
+ v4 API, this strict approach must track too many combinations and permutations
487
+ to be practical. Ruby/AWS therefore no longer tries.
488
+
489
+ Instead, it's now up to you to ensure that you perform legal operations and
490
+ pass in sensible parameters and values for the locale in which you're working.
491
+
492
+ Parameter name checking, however, _is_ still performed. For example,
493
+ performing an ItemSearch and passing in a 'Keywrds' parameter would generate
494
+ an exception, because 'Keywrds' doesn't exist as a parameter in any context.
495
+ Here, 'Keywords' was obviously what was intended and a simple typo was made by
496
+ the user.
497
+
498
+ Similarly, the SearchIndex must also actually exist, so 'Music' or 'Beauty'
499
+ would be valid, but 'Furniture' or 'MobilePhones' would not, because Amazon
500
+ does not (currently) offer such indices.
501
+
502
+ In conclusion, we can say that broad checks are performed to determine whether
503
+ a search _could_ conceivably be valid in any context, but it's up to you to
504
+ determine whether the search actually _is_ valid in your particular context.
505
+
506
+ Thankfully, with the AWS Developer Guide at your side, it's largely common
507
+ sense which parameters and values can be used with each type of search. It's
508
+ less obvious when these differ by locale, such as 'Beauty' being a valid
509
+ SearchIndex in the 'us' locale, bot not in the 'uk'. AWS unfortunately abounds
510
+ with such inconsistencies.
511
+
512
+ The only way to apprise yourself of such quirks is to read Amazon's latest
513
+ developer documentation (and closely follow the release notes of each minor
514
+ API revision to make sure things haven't changed).
515
+
516
+ The AWS Developer Connection pages may also be of use to you. In particular,
517
+ the forum for discussing AWS has proved useful to me over the years:
518
+
519
+ http://developer.amazonwebservices.com/connect/forum.jspa?forumID=9
520
+
521
+ For those illegal operations that make it through and are passed to the Amazon
522
+ servers, the good news is that Amazon carries out extensive request-time
523
+ parameter checking in AWS v4 (much better than in v3) and will generate an
524
+ error when an illegal set of parameters and values is given. Ruby/AWS will
525
+ dynamically generate an exception class for the reported type of error and
526
+ raise an exception of that class.
527
+
528
+ Using this approach, Ruby/AWS doesn't have to perform checks that Amazon will
529
+ perform later anyway. This helps keep the code base leaner, the library
530
+ faster, and reduces the chances of Ruby/AWS disallowing operations that will
531
+ one day be allowed in a minor revision of AWS.
532
+
533
+
534
+ Documentation
535
+ -------------
536
+
537
+ You can generate HTML documentation for the library with the following
538
+ command, executed from the directory created when you unpacked the archive:
539
+
540
+ rdoc -SUx CVS lib
541
+
542
+ The documentation on how to use this library is currently incomplete, but that
543
+ is steadily being remedied.
544
+
545
+ You can also use the Ruby/AWS mailing-list:
546
+
547
+ http://www.caliban.org/mailman/listinfo/ruby-aws
548
+
549
+ to discuss all Ruby/AWS-related subjects and issues.
550
+
551
+
552
+ Examples
553
+ --------
554
+
555
+ The ./examples subdirectory contains working examples of code.
556
+
557
+
558
+ Licence
559
+ -------
560
+
561
+ This software is copyright (C) 2008 Ian Macdonald and distributed under the
562
+ terms of the GNU GENERAL PUBLIC LICENSE, a copy of which is included.
563
+
564
+ --
565
+ Ian Macdonald
566
+ <ian@caliban.org>
data/README.rdoc ADDED
@@ -0,0 +1,129 @@
1
+ = Ruby/AWS - A Ruby interface to the Amazon Associates Web Services API.
2
+
3
+ == Introduction
4
+
5
+ Ruby/AWS is a Ruby language library that allows programmatic access to
6
+ the popular Amazon Web sites via the AWS v4 API. It is the successor to the
7
+ now obsolete Ruby/Amazon.
8
+
9
+ In addition to the original
10
+ amazon.com[http://www.amazon.com/exec/obidos/redirect-home/calibanorg-20]
11
+ site, the local sites
12
+ amazon.co.uk[http://www.amazon.co.uk/exec/obidos/redirect-home/caliban-21],
13
+ amazon.de[http://www.amazon.de/exec/obidos/redirect-home/calibanorg0a-21],
14
+ amazon.fr[http://www.amazon.fr/exec/obidos/redirect-home/caliban08-21],
15
+ amazon.ca[http://www.amazon.ca/exec/obidos/redirect-home/caliban-20] and
16
+ amazon.co.jp[http://www.amazon.co.jp/exec/obidos/redirect-home/calibanorg-20]
17
+ are also supported.
18
+
19
+ Although the library is still in development, the AWS v4 API is now more or
20
+ less fully supported, with only tiny gaps in the functionality of some
21
+ operations.
22
+
23
+ The following operations are supported:
24
+
25
+ BrowseNodeLookup
26
+ CustomerContentLookup
27
+ CustomerContentSearch
28
+ Help
29
+ ItemLookup
30
+ ItemSearch
31
+ ListLookup
32
+ ListSearch
33
+ SellerListingLookup
34
+ SellerListingSearch
35
+ SellerLookup
36
+ SimilarityLookup
37
+ TagLookup
38
+ TransactionLookup
39
+
40
+ Remote shopping-carts are also supported. This adds the following operations:
41
+
42
+ CartCreate
43
+ CartAdd
44
+ CartModify
45
+ CartClear
46
+ CartGet
47
+
48
+ In addition, multiple operations and batch requests are also supported.
49
+
50
+ Ruby/AWS also offers advanced features not directly available in the AWS
51
+ API, such as the ability to retrieve *all* results pages for a particular
52
+ search, rather than having to manually deal with AWS responses of 10 results
53
+ per page.
54
+
55
+ You can also retrieve product images and optionally overlay them with
56
+ percentage discount icons.
57
+
58
+ Another advanced feature is the ability to cache responses returned by AWS.
59
+ If the cache is used (as it is by default), the results of each unique
60
+ query will be cached and used for 24 hours. The cache can be manually
61
+ flushed of all or just the expired entries.
62
+
63
+ One other useful advanced feature is the ability to determine the
64
+ appropriate Amazon locale for a given client, based on its IP address or
65
+ host name. This allows you to perform AWS operations using the correct
66
+ geographical Amazon site for any given client. German and Austrian clients
67
+ can be made to interact with amazon.de, British and Irish clients with
68
+ amazon.co.uk, etc.
69
+
70
+
71
+ == Installation
72
+
73
+ Please see the +INSTALL+ file supplied with the software for details of how
74
+ to install Ruby/AWS. You can choose between an installation script and a
75
+ RubyGems[http://www.rubygems.org/] installation.
76
+
77
+ Note, however, if choosing the gem installation, that whilst Ruby/AWS's
78
+ RubyForge UNIX name is now ruby-aaws. The ruby-aws name was taken by
79
+ {another project}[http://rubyforge.org/projects/ruby-aws/] and this clash
80
+ prevented remote installation of the Ruby/AWS gem.
81
+
82
+
83
+ == Prerequisites
84
+
85
+ Before you can use this library, you need to obtain an Amazon Web Services
86
+ {access key
87
+ ID}[https://aws-portal.amazon.com/gp/aws/developer/registration/index.html].
88
+
89
+ You should also apply for an {Associates
90
+ account}[http://docs.amazonwebservices.com/AWSECommerceService/2008-04-07/GSG/BecominganAssociate.html],
91
+ although this isn't strictly necessary. If you do not explicitly provide an
92
+ Associates tag in your calls through Ruby/AWS, the tag of the Ruby/AWS
93
+ author will be used by default.
94
+
95
+
96
+ == See Also
97
+
98
+ Ultimately, the way to get the most from this library is to read the AWS
99
+ documentation to get a feel for what is possible, and then experiment with
100
+ this library to see how the AWS calls are mapped into the Ruby world. You
101
+ should also review this library's
102
+ RDoc[http://www.ruby-doc.org/core/classes/RDoc.html]
103
+ documentation[http://www.caliban.org/ruby/ruby-aws/] as well as the
104
+ plain-text +README+ file that came with the archive.
105
+
106
+ Additionally, there's a
107
+ {mailing-list}[http://www.caliban.org/mailman/listinfo/ruby-aws] available,
108
+ where you can discuss all Ruby/AWS-related subjects and issues.
109
+
110
+ Please see the Amazon Web Services
111
+ documentation[http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=5]
112
+ for definitive information on the capabilities and inner workings of the AWS
113
+ API.
114
+
115
+
116
+ == Download
117
+
118
+ Version 0.4.4
119
+ === {gzip'ed tar archive}[http://www.caliban.org/files/ruby/ruby-aws-0.4.4.tar.gz]
120
+ === {Ruby Gem}[http://www.caliban.org/files/ruby/ruby-aaws-0.4.4.gem]
121
+ === {Fedora 9 RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-0.4.4-1.fc9.noarch.rpm]
122
+ === {Fedora 9 doc RPM}[http://www.caliban.org/files/redhat/RPMS/noarch/ruby-aws-doc-0.4.4-1.fc9.noarch.rpm]
123
+ === {Fedora 9 source RPM}[http://www.caliban.org/files/redhat/SRPMS/ruby-aws-0.4.4-1.fc9.src.rpm]
124
+
125
+
126
+ ---
127
+ Author:: Ian Macdonald <mailto:ian@caliban.org>
128
+ Version:: 0.4.4
129
+ Licence:: GPL[http://www.gnu.org/copyleft/gpl.html]