papercavalier-ruby-aaws 0.8.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.
Files changed (59) hide show
  1. data/.gitignore +3 -0
  2. data/COPYING +340 -0
  3. data/INSTALL +260 -0
  4. data/NEWS +808 -0
  5. data/README +679 -0
  6. data/README.rdoc +140 -0
  7. data/Rakefile +17 -0
  8. data/VERSION.yml +5 -0
  9. data/example/batch_operation +28 -0
  10. data/example/browse_node_lookup1 +46 -0
  11. data/example/customer_content_lookup1 +27 -0
  12. data/example/customer_content_search1 +21 -0
  13. data/example/example1 +78 -0
  14. data/example/help1 +24 -0
  15. data/example/item_lookup1 +56 -0
  16. data/example/item_lookup2 +56 -0
  17. data/example/item_search1 +30 -0
  18. data/example/item_search2 +37 -0
  19. data/example/item_search3 +23 -0
  20. data/example/list_lookup1 +29 -0
  21. data/example/list_search1 +30 -0
  22. data/example/multiple_operation1 +69 -0
  23. data/example/seller_listing_lookup1 +30 -0
  24. data/example/seller_listing_search1 +29 -0
  25. data/example/seller_lookup1 +45 -0
  26. data/example/shopping_cart1 +42 -0
  27. data/example/similarity_lookup1 +48 -0
  28. data/example/tag_lookup1 +34 -0
  29. data/example/transaction_lookup1 +25 -0
  30. data/example/vehicle_search +22 -0
  31. data/lib/amazon.rb +165 -0
  32. data/lib/amazon/aws.rb +1493 -0
  33. data/lib/amazon/aws/cache.rb +141 -0
  34. data/lib/amazon/aws/search.rb +464 -0
  35. data/lib/amazon/aws/shoppingcart.rb +537 -0
  36. data/lib/amazon/locale.rb +102 -0
  37. data/test/setup.rb +56 -0
  38. data/test/tc_amazon.rb +20 -0
  39. data/test/tc_aws.rb +160 -0
  40. data/test/tc_browse_node_lookup.rb +49 -0
  41. data/test/tc_customer_content_lookup.rb +49 -0
  42. data/test/tc_help.rb +44 -0
  43. data/test/tc_item_lookup.rb +47 -0
  44. data/test/tc_item_search.rb +105 -0
  45. data/test/tc_list_lookup.rb +60 -0
  46. data/test/tc_list_search.rb +44 -0
  47. data/test/tc_multiple_operation.rb +375 -0
  48. data/test/tc_operation_request.rb +64 -0
  49. data/test/tc_seller_listing_lookup.rb +47 -0
  50. data/test/tc_seller_listing_search.rb +55 -0
  51. data/test/tc_seller_lookup.rb +44 -0
  52. data/test/tc_serialisation.rb +107 -0
  53. data/test/tc_shopping_cart.rb +214 -0
  54. data/test/tc_similarity_lookup.rb +48 -0
  55. data/test/tc_tag_lookup.rb +24 -0
  56. data/test/tc_transaction_lookup.rb +24 -0
  57. data/test/tc_vehicle_operations.rb +118 -0
  58. data/test/ts_aws.rb +24 -0
  59. metadata +141 -0
@@ -0,0 +1,48 @@
1
+ # $Id: tc_similarity_lookup.rb,v 1.2 2010/02/20 17:15:18 ianmacd Exp $
2
+ #
3
+
4
+ require 'test/unit'
5
+ require './setup'
6
+
7
+ class TestSimilarityLookup < AWSTest
8
+
9
+ def test_similarity_lookup
10
+
11
+ sl = SimilarityLookup.new( [ 'B000AE4QEC', 'B000051WBE' ] )
12
+ sl_rg = ResponseGroup.new( :Subjects )
13
+ sl.response_group = sl_rg
14
+
15
+ response = @req.search( sl )
16
+
17
+ items = response.similarity_lookup_response[0].items
18
+
19
+ assert_match( /^\w+/, items.item[0].subjects.subject[0] )
20
+ assert_match( /^\w+/, items.item[1].subjects.subject[0] )
21
+
22
+ end
23
+
24
+ def test_similarity_lookup_class_method
25
+
26
+ response = Amazon::AWS.similarity_lookup( [ 'B000AE4QEC', 'B000051WBE' ] )
27
+
28
+ items = response.similarity_lookup_response[0].items
29
+
30
+ assert_match( /^http:/, items.item[0].detail_page_url )
31
+ assert_match( /^http:/, items.item[1].detail_page_url )
32
+
33
+ end
34
+
35
+ def test_item_search_class_method_block
36
+
37
+ Amazon::AWS.similarity_lookup( [ 'B000AE4QEC', 'B000051WBE' ] ) do |r|
38
+
39
+ items = r.similarity_lookup_response[0].items
40
+
41
+ assert_match( /^http:/, items.item[0].detail_page_url )
42
+ assert_match( /^http:/, items.item[1].detail_page_url )
43
+
44
+ end
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,24 @@
1
+ # $Id: tc_tag_lookup.rb,v 1.2 2010/02/20 17:15:18 ianmacd Exp $
2
+ #
3
+
4
+ require 'test/unit'
5
+ require './setup'
6
+
7
+ class TestTagLookup < AWSTest
8
+
9
+ def test_tag_lookup
10
+
11
+ @req.locale = 'us'
12
+ tl = TagLookup.new( 'Awful' )
13
+ tl_rg = ResponseGroup.new( :Tags, :TagsSummary )
14
+ tl.response_group = tl_rg
15
+
16
+ response = @req.search( tl )
17
+
18
+ tag = response.kernel
19
+
20
+ assert_equal( '2005-11-21 16:46:53', tag.first_tagging.time )
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,24 @@
1
+ # $Id: tc_transaction_lookup.rb,v 1.2 2010/02/20 17:15:19 ianmacd Exp $
2
+ #
3
+
4
+ require 'test/unit'
5
+ require './setup'
6
+
7
+ class TestTransactionLookup < AWSTest
8
+
9
+ def test_transaction_lookup
10
+
11
+ @req.locale = 'us'
12
+ tl = TransactionLookup.new( '103-5663398-5028241' )
13
+ tl_rg = ResponseGroup.new( :TransactionDetails )
14
+ tl.response_group = tl_rg
15
+
16
+ response = @req.search( tl )
17
+
18
+ trans = response.kernel
19
+
20
+ assert_equal( '2008-04-13T23:49:38', trans.transaction_date )
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/ruby -w
2
+ #
3
+ # $Id: tc_vehicle_operations.rb,v 1.2 2010/02/20 17:15:19 ianmacd Exp $
4
+
5
+ require 'test/unit'
6
+ require './setup'
7
+
8
+ class TestVehicles < AWSTest
9
+
10
+ def test_vehicle_search
11
+ @req.locale = 'us'
12
+
13
+ # Get all cars for year 2008.
14
+ #
15
+ vs = VehicleSearch.new( { 'Year' => 2008 } )
16
+ vs_rg = ResponseGroup.new( 'VehicleMakes' )
17
+ vs.response_group = vs_rg
18
+
19
+ response = @req.search( vs )
20
+
21
+ makes = response.vehicle_search_response[0].vehicle_years[0].
22
+ vehicle_year[0].vehicle_makes[0].vehicle_make
23
+ assert( makes.size > 0 )
24
+
25
+ make_id = makes.find { |make| make.make_name == 'Audi' }.make_id.to_i
26
+
27
+
28
+ # Get all Audi models from 2008.
29
+ #
30
+ vs = VehicleSearch.new( { 'Year' => 2008,
31
+ 'MakeId' => make_id } )
32
+ vs_rg = ResponseGroup.new( 'VehicleModels' )
33
+ vs.response_group = vs_rg
34
+
35
+ response = @req.search( vs )
36
+
37
+ models = response.vehicle_search_response[0].vehicle_years[0].
38
+ vehicle_year[0].vehicle_makes[0].vehicle_make[0].
39
+ vehicle_models[0].vehicle_model
40
+ assert( models.size > 0 )
41
+
42
+ model_id = models.find { |model| model.model_name == 'R8' }.model_id.to_i
43
+
44
+ # Get all Audi R8 trim packages from 2008.
45
+ #
46
+ vs = VehicleSearch.new( { 'Year' => 2008,
47
+ 'MakeId' => make_id,
48
+ 'ModelId' => model_id } )
49
+ vs_rg = ResponseGroup.new( 'VehicleTrims' )
50
+ vs.response_group = vs_rg
51
+
52
+ response = @req.search( vs )
53
+
54
+ trims = response.vehicle_search_response[0].vehicle_years[0].
55
+ vehicle_year[0].vehicle_makes[0].vehicle_make[0].
56
+ vehicle_models[0].vehicle_model[0].vehicle_trims[0].vehicle_trim
57
+ assert( trims.size > 0 )
58
+
59
+ trim_id = trims.find { |trim| trim.trim_name == 'Base' }.trim_id.to_i
60
+
61
+ vs = VehicleSearch.new( { 'Year' => 2008,
62
+ 'MakeId' => make_id,
63
+ 'ModelId' => model_id,
64
+ 'TrimId' => trim_id } )
65
+ vs_rg = ResponseGroup.new( 'VehicleOptions' )
66
+ vs.response_group = vs_rg
67
+
68
+ response = @req.search( vs )
69
+
70
+ options = response.vehicle_search_response[0].vehicle_years[0].
71
+ vehicle_year[0].vehicle_makes[0].vehicle_make[0].
72
+ vehicle_models[0].vehicle_model[0].vehicle_trims[0].
73
+ vehicle_trim[0].vehicle_options[0]
74
+ engine = options.vehicle_engine_options.vehicle_engine
75
+ engine_name = engine.engine_name
76
+ engine_id = engine.engine_id
77
+ assert_not_nil( engine_name )
78
+
79
+ # Find parts for our 2008 Audi R8 with Base trim and whatever engine that
80
+ # trim package has.
81
+ #
82
+ vps = VehiclePartSearch.new( 2008, make_id, model_id,
83
+ { 'TrimId' => trim_id,
84
+ 'EngineId' => engine_id } )
85
+ vps_rg = ResponseGroup.new( 'VehicleParts' )
86
+ vps.response_group = vps_rg
87
+
88
+ response = @req.search( vps )
89
+
90
+ parts = response.vehicle_part_search_response[0].vehicle_parts[0].part
91
+ assert( parts.size > 0 )
92
+
93
+ # Now, we do a reverse look-up.
94
+ #
95
+ # Go through all parts and test to see if they fit in our 2008 Audi R8
96
+ # Base trim. The answer should always be yes.
97
+ #
98
+ # part = parts[rand( parts.size - 1 )].item.asin
99
+
100
+ parts.each do |part|
101
+ vpl = VehiclePartLookup.new( part.item.asin,
102
+ { 'Year' => 2008,
103
+ 'MakeId' => make_id,
104
+ 'ModelId' => model_id,
105
+ 'TrimId' => trim_id } )
106
+
107
+ vpl_rg = ResponseGroup.new( 'VehiclePartFit' )
108
+ vpl.response_group = vpl_rg
109
+
110
+ response = @req.search( vpl )
111
+
112
+ fit = response.vehicle_part_lookup_response[0].vehicle_parts[0].part.
113
+ vehicle_part_fit.is_fit
114
+ assert_equal( 'YES', fit )
115
+ end
116
+ end
117
+
118
+ end
@@ -0,0 +1,24 @@
1
+ # $Id: ts_aws.rb,v 1.17 2009/06/03 23:25:33 ianmacd Exp $
2
+ #
3
+
4
+ require 'test/unit'
5
+ require 'tc_amazon'
6
+ require 'tc_aws'
7
+ require 'tc_browse_node_lookup'
8
+ require 'tc_customer_content_lookup'
9
+ require 'tc_help'
10
+ require 'tc_item_lookup'
11
+ require 'tc_item_search'
12
+ require 'tc_list_lookup'
13
+ require 'tc_list_search'
14
+ require 'tc_multiple_operation'
15
+ require 'tc_operation_request'
16
+ require 'tc_seller_listing_lookup'
17
+ require 'tc_seller_listing_search'
18
+ require 'tc_seller_lookup'
19
+ require 'tc_serialisation'
20
+ require 'tc_similarity_lookup'
21
+ require 'tc_shopping_cart'
22
+ require 'tc_tag_lookup'
23
+ require 'tc_transaction_lookup'
24
+ require 'tc_vehicle_operations'
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: papercavalier-ruby-aaws
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 8
8
+ - 1
9
+ version: 0.8.1
10
+ platform: ruby
11
+ authors:
12
+ - Ian Macdonald
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-25 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Ruby/AWS is a Ruby wrapper to the Amazon Product Advertising API.
22
+ email: code@papercavalier.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README
29
+ - README.rdoc
30
+ files:
31
+ - .gitignore
32
+ - COPYING
33
+ - INSTALL
34
+ - NEWS
35
+ - README
36
+ - README.rdoc
37
+ - Rakefile
38
+ - VERSION.yml
39
+ - example/batch_operation
40
+ - example/browse_node_lookup1
41
+ - example/customer_content_lookup1
42
+ - example/customer_content_search1
43
+ - example/example1
44
+ - example/help1
45
+ - example/item_lookup1
46
+ - example/item_lookup2
47
+ - example/item_search1
48
+ - example/item_search2
49
+ - example/item_search3
50
+ - example/list_lookup1
51
+ - example/list_search1
52
+ - example/multiple_operation1
53
+ - example/seller_listing_lookup1
54
+ - example/seller_listing_search1
55
+ - example/seller_lookup1
56
+ - example/shopping_cart1
57
+ - example/similarity_lookup1
58
+ - example/tag_lookup1
59
+ - example/transaction_lookup1
60
+ - example/vehicle_search
61
+ - lib/amazon.rb
62
+ - lib/amazon/aws.rb
63
+ - lib/amazon/aws/cache.rb
64
+ - lib/amazon/aws/search.rb
65
+ - lib/amazon/aws/shoppingcart.rb
66
+ - lib/amazon/locale.rb
67
+ - test/setup.rb
68
+ - test/tc_amazon.rb
69
+ - test/tc_aws.rb
70
+ - test/tc_browse_node_lookup.rb
71
+ - test/tc_customer_content_lookup.rb
72
+ - test/tc_help.rb
73
+ - test/tc_item_lookup.rb
74
+ - test/tc_item_search.rb
75
+ - test/tc_list_lookup.rb
76
+ - test/tc_list_search.rb
77
+ - test/tc_multiple_operation.rb
78
+ - test/tc_operation_request.rb
79
+ - test/tc_seller_listing_lookup.rb
80
+ - test/tc_seller_listing_search.rb
81
+ - test/tc_seller_lookup.rb
82
+ - test/tc_serialisation.rb
83
+ - test/tc_shopping_cart.rb
84
+ - test/tc_similarity_lookup.rb
85
+ - test/tc_tag_lookup.rb
86
+ - test/tc_transaction_lookup.rb
87
+ - test/tc_vehicle_operations.rb
88
+ - test/ts_aws.rb
89
+ has_rdoc: true
90
+ homepage: http://github.com/papercavalier/ruby-aaws
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options:
95
+ - --charset=UTF-8
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ requirements: []
113
+
114
+ rubyforge_project:
115
+ rubygems_version: 1.3.6
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: Ruby/AWS is a Ruby wrapper to the Amazon Product Advertising API.
119
+ test_files:
120
+ - test/setup.rb
121
+ - test/tc_amazon.rb
122
+ - test/tc_aws.rb
123
+ - test/tc_browse_node_lookup.rb
124
+ - test/tc_customer_content_lookup.rb
125
+ - test/tc_help.rb
126
+ - test/tc_item_lookup.rb
127
+ - test/tc_item_search.rb
128
+ - test/tc_list_lookup.rb
129
+ - test/tc_list_search.rb
130
+ - test/tc_multiple_operation.rb
131
+ - test/tc_operation_request.rb
132
+ - test/tc_seller_listing_lookup.rb
133
+ - test/tc_seller_listing_search.rb
134
+ - test/tc_seller_lookup.rb
135
+ - test/tc_serialisation.rb
136
+ - test/tc_shopping_cart.rb
137
+ - test/tc_similarity_lookup.rb
138
+ - test/tc_tag_lookup.rb
139
+ - test/tc_transaction_lookup.rb
140
+ - test/tc_vehicle_operations.rb
141
+ - test/ts_aws.rb