amazon-mws 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/.gitignore +1 -0
  2. data/README.markdown +31 -0
  3. data/Rakefile +14 -0
  4. data/VERSION +1 -0
  5. data/amazon-mws.gemspec +164 -0
  6. data/examples/xml/cancel_feed_submissions.xml +16 -0
  7. data/examples/xml/cancel_report_requests.xml +18 -0
  8. data/examples/xml/error.xml +10 -0
  9. data/examples/xml/get_feed_submission_count.xml +10 -0
  10. data/examples/xml/get_feed_submission_list.xml +16 -0
  11. data/examples/xml/get_feed_submission_list_by_next_token.xml +16 -0
  12. data/examples/xml/get_feed_submission_result.xml +30 -0
  13. data/examples/xml/get_report_count.xml +9 -0
  14. data/examples/xml/get_report_list.xml +17 -0
  15. data/examples/xml/get_report_request_count.xml +8 -0
  16. data/examples/xml/get_report_request_list.xml +120 -0
  17. data/examples/xml/get_report_request_list_by_next_token.xml +20 -0
  18. data/examples/xml/get_report_schedule_count.xml +10 -0
  19. data/examples/xml/get_report_schedule_list.xml +15 -0
  20. data/examples/xml/get_report_schedule_list_by_next_token.xml +15 -0
  21. data/examples/xml/manage_report_schedule.xml +14 -0
  22. data/examples/xml/request_report.xml +17 -0
  23. data/examples/xml/submit_feed.xml +14 -0
  24. data/examples/xml/update_report_acknowledgements.xml +18 -0
  25. data/examples/xsd/Inventory.xsd +49 -0
  26. data/examples/xsd/Item.xsd +285 -0
  27. data/examples/xsd/Listings.xsd +32 -0
  28. data/examples/xsd/OrderAcknowledgement.xsd +55 -0
  29. data/examples/xsd/OrderAdjustment.xsd +94 -0
  30. data/examples/xsd/OrderFulfillment.xsd +57 -0
  31. data/examples/xsd/Override.xsd +48 -0
  32. data/examples/xsd/Price.xsd +59 -0
  33. data/examples/xsd/ProcessingReport.xsd +87 -0
  34. data/examples/xsd/Product.xsd +220 -0
  35. data/examples/xsd/Product/AutoAccessory.xsd +807 -0
  36. data/examples/xsd/Product/Beauty.xsd +114 -0
  37. data/examples/xsd/Product/CE.xsd +544 -0
  38. data/examples/xsd/Product/CameraPhoto.xsd +2410 -0
  39. data/examples/xsd/Product/FoodAndBeverages.xsd +270 -0
  40. data/examples/xsd/Product/Gourmet.xsd +85 -0
  41. data/examples/xsd/Product/Health.xsd +189 -0
  42. data/examples/xsd/Product/Home.xsd +654 -0
  43. data/examples/xsd/Product/Jewelry.xsd +603 -0
  44. data/examples/xsd/Product/Miscellaneous.xsd +157 -0
  45. data/examples/xsd/Product/MusicalInstruments.xsd +853 -0
  46. data/examples/xsd/Product/Office.xsd +550 -0
  47. data/examples/xsd/Product/PetSupplies.xsd +40 -0
  48. data/examples/xsd/Product/ProductClothing.xsd +197 -0
  49. data/examples/xsd/Product/SWVG.xsd +238 -0
  50. data/examples/xsd/Product/Sports.xsd +308 -0
  51. data/examples/xsd/Product/TiresAndWheels.xsd +159 -0
  52. data/examples/xsd/Product/Tools.xsd +66 -0
  53. data/examples/xsd/Product/ToysBaby.xsd +241 -0
  54. data/examples/xsd/Product/Wireless.xsd +77 -0
  55. data/examples/xsd/ProductImage.xsd +39 -0
  56. data/examples/xsd/Relationship.xsd +47 -0
  57. data/examples/xsd/SettlementReport.xsd +158 -0
  58. data/examples/xsd/amzn-base.xsd +1601 -0
  59. data/examples/xsd/amzn-envelope.xsd +98 -0
  60. data/examples/xsd/amzn-header.xsd +45 -0
  61. data/lib/amazon/mws.rb +86 -0
  62. data/lib/amazon/mws/authentication.rb +9 -0
  63. data/lib/amazon/mws/authentication/query_string.rb +28 -0
  64. data/lib/amazon/mws/authentication/signature.rb +43 -0
  65. data/lib/amazon/mws/base.rb +61 -0
  66. data/lib/amazon/mws/connection.rb +99 -0
  67. data/lib/amazon/mws/connection/management.rb +94 -0
  68. data/lib/amazon/mws/connection/request_builder.rb +67 -0
  69. data/lib/amazon/mws/exceptions.rb +80 -0
  70. data/lib/amazon/mws/feed.rb +223 -0
  71. data/lib/amazon/mws/feed_builder.rb +67 -0
  72. data/lib/amazon/mws/feed_enumerations.rb +46 -0
  73. data/lib/amazon/mws/feed_submission.rb +14 -0
  74. data/lib/amazon/mws/lib/extensions.rb +162 -0
  75. data/lib/amazon/mws/lib/memoizable.rb +10 -0
  76. data/lib/amazon/mws/orders.rb +9 -0
  77. data/lib/amazon/mws/report.rb +310 -0
  78. data/lib/amazon/mws/report_enumerations.rb +44 -0
  79. data/lib/amazon/mws/report_info.rb +16 -0
  80. data/lib/amazon/mws/report_request.rb +19 -0
  81. data/lib/amazon/mws/report_schedule.rb +13 -0
  82. data/lib/amazon/mws/response.rb +32 -0
  83. data/lib/amazon/mws/response/cancel_feed_submissions_response.rb +14 -0
  84. data/lib/amazon/mws/response/cancel_report_requests_response.rb +14 -0
  85. data/lib/amazon/mws/response/get_feed_submission_count_response.rb +13 -0
  86. data/lib/amazon/mws/response/get_feed_submission_list_by_next_token_response.rb +15 -0
  87. data/lib/amazon/mws/response/get_feed_submission_list_response.rb +15 -0
  88. data/lib/amazon/mws/response/get_feed_submission_result_response.rb +54 -0
  89. data/lib/amazon/mws/response/get_report_count_response.rb +13 -0
  90. data/lib/amazon/mws/response/get_report_list_response.rb +15 -0
  91. data/lib/amazon/mws/response/get_report_request_count_response.rb +13 -0
  92. data/lib/amazon/mws/response/get_report_request_list_by_next_token_response.rb +15 -0
  93. data/lib/amazon/mws/response/get_report_request_list_response.rb +15 -0
  94. data/lib/amazon/mws/response/get_report_schedule_count_response.rb +13 -0
  95. data/lib/amazon/mws/response/get_report_schedule_list_by_next_token_response.rb +15 -0
  96. data/lib/amazon/mws/response/get_report_schedule_list_response.rb +15 -0
  97. data/lib/amazon/mws/response/manage_report_schedule_response.rb +14 -0
  98. data/lib/amazon/mws/response/request_report_response.rb +14 -0
  99. data/lib/amazon/mws/response/response_error.rb +15 -0
  100. data/lib/amazon/mws/response/submit_feed_response.rb +13 -0
  101. data/lib/amazon/mws/response/update_reports_acknowledgements_response.rb +14 -0
  102. data/lib/amazon/mws/version.rb +12 -0
  103. data/pkg/amazon-mws-0.1.0.gem +0 -0
  104. data/test/authentication_test.rb +15 -0
  105. data/test/connection_test.rb +5 -0
  106. data/test/feed_builder_test.rb +15 -0
  107. data/test/feed_submission_test.rb +32 -0
  108. data/test/feed_test.rb +64 -0
  109. data/test/query_string_test.rb +21 -0
  110. data/test/report_test.rb +29 -0
  111. data/test/request_test.rb +18 -0
  112. data/test/response_test.rb +197 -0
  113. data/test/signature_test.rb +30 -0
  114. data/test/test_config.yml +5 -0
  115. data/test/test_helper.rb +22 -0
  116. metadata +179 -0
@@ -0,0 +1,14 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class UpdateReportAcknowledgementsResponse < Response
5
+ xml_name "UpdateReportAcknowledgementsResponse"
6
+ result = "UpdateReportAcknowledgementsResult"
7
+
8
+ xml_reader :count, :as => Integer, :in => result
9
+ xml_reader :reports, :as => [ReportInfo], :in => result
10
+ xml_reader :request_id, :in => "ResponseMetadata"
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ module Amazon
2
+ module MWS
3
+ module VERSION #:nodoc:
4
+ MAJOR = '0'
5
+ MINOR = '0'
6
+ TINY = '1'
7
+ BETA = Time.now.to_i.to_s
8
+ end
9
+
10
+ Version = [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY, VERSION::BETA].compact * '.'
11
+ end
12
+ end
Binary file
@@ -0,0 +1,15 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class AuthenticationTest < Test::Unit::TestCase
4
+ def setup
5
+ @request = Net::HTTP::Get.new("https://mws.amazonaws.com")
6
+ @access_key_id = "yyy"
7
+ @secret_access_key = "xxx"
8
+ @merchant_id = 0
9
+ @marketplace_id = 0
10
+ end
11
+
12
+ def test_first
13
+ puts Amazon::MWS::Authentication::QueryString.new(@request, @access_key_id, @secret_access_key, @merchant_id, @marketplace_id)
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class ConnectionTest < Test::Unit::TestCase
4
+
5
+ end
@@ -0,0 +1,15 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class FeedTest < Test::Unit::TestCase
4
+ def setup
5
+ end
6
+
7
+ def test_nothing
8
+ puts AWS::MWS::FeedBuilder.new(:product, {
9
+ "Product" => "somethinglame",
10
+ "NestedHash" => {"hash"=> 7},
11
+ "NestedArray" => [{"NA1"=> 1}, {"NA2"=> 2}]
12
+ }).render
13
+ # puts feed.xml
14
+ end
15
+ end
@@ -0,0 +1,32 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'yaml'
3
+
4
+ class FeedSubmissionTest < Test::Unit::TestCase
5
+ def setup
6
+ config = YAML.load_file( File.join(File.dirname(__FILE__), '../lib/amazon/mws.yml') )
7
+
8
+ AWS::MWS::Base.establish_connection!(
9
+ config['production']
10
+ )
11
+ end
12
+
13
+ def test_get_feed_submission_list
14
+ # Amazon::MWS::API.submit_feed(:product_data, :product, @product)
15
+ # response = Amazon::MWS::API.get_feed_submission_list
16
+
17
+ #response = Amazon::MWS::API.request_report(:flat_file_orders)
18
+
19
+ #report_id = response["RequestReportResponse"]["RequestReportResult"]["ReportRequestInfo"]["ReportRequestId"]
20
+
21
+
22
+ response = Amazon::MWS::API.get_report_list
23
+
24
+ report_id = response["GetReportListResult"]["ReportInfo"]["ReportId"]
25
+
26
+ response = Amazon::MWS::API.get_report(report_id)
27
+ #response = Amazon::MWS::API.get_report_request_list
28
+
29
+ #response = Amazon::MWS::API.get_report_request_count
30
+ puts response.inspect
31
+ end
32
+ end
@@ -0,0 +1,64 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ # flatten the namespace
3
+ require 'mocha'
4
+ include AWS::MWS
5
+
6
+ AWS::MWS::Base.debug = true
7
+
8
+ class FeedTest < Test::Unit::TestCase
9
+ def setup
10
+ config = YAML.load_file( File.join(File.dirname(__FILE__), 'test_config.yml') )
11
+ @marketplace = AWS::MWS::Base.new(config)
12
+ end
13
+
14
+ #def test_submit_feed
15
+ #response = Feed.submit
16
+ #response = Feed.submit_feed
17
+ #end
18
+
19
+ def test_get_feed_submission_list_failure
20
+ @marketplace.stubs(:get).returns(
21
+ mock_response(401, :body => File.read(xml_for('error')), :content_type => "text/xml")
22
+ )
23
+
24
+ response = @marketplace.submission_list
25
+ assert_kind_of(ResponseError, response)
26
+ end
27
+
28
+ def test_get_feed_submission_list_success
29
+ @marketplace.stubs(:get).returns(
30
+ mock_response(200, :body => File.read(xml_for('get_feed_submission_list')), :content_type => "text/xml")
31
+ )
32
+
33
+ response = @marketplace.submission_list
34
+ assert_kind_of(GetFeedSubmissionListResponse, response)
35
+ end
36
+
37
+ =begin
38
+ def test_get_feed_submission_list_by_next_token
39
+ #response = Feed.submission_list_by_next_token
40
+ #response = Feed.get_feed_submission_list_by_next_token
41
+ end
42
+
43
+ def test_get_feed_submission_list_by_next_token
44
+ #response = Feed.submission_list_by_next_token
45
+ #response = Feed.get_feed_submission_list_by_next_token
46
+ end
47
+
48
+ def test_get_feed_submission_count
49
+ #response = Feed.submission_count
50
+ #response = Feed.get_feed_submission_count
51
+ end
52
+
53
+
54
+ def test_cancel_feed_submissions
55
+ #response = Feed.cancel_submissions
56
+ #response = Feed.cancel_feed_submissions
57
+ end
58
+
59
+ def test_get_feed_submission_result
60
+ #response = Feed.submission_result
61
+ #response = Feed.get_feed_submission_result
62
+ end
63
+ =end
64
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class MockSignature
4
+ end
5
+
6
+ class QueryStringTest < Test::Unit::TestCase
7
+ def setup
8
+ # need a stub for Signature!
9
+ end
10
+
11
+ def test_expected_string
12
+ string = AWS::MWS::Authentication::QueryString.new(
13
+ :access_key => 'opensesame',
14
+ :marketplace_id => '9876',
15
+ :merchant_id => '12345',
16
+ :uri => URI.parse('/')
17
+ )
18
+
19
+ assert_kind_of(String, string)
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'yaml'
3
+
4
+
5
+ # import the namespace
6
+ include Amazon::MWS
7
+
8
+ class FeedTest < Test::Unit::TestCase
9
+ def setup
10
+ config = YAML.load_file( File.join(File.dirname(__FILE__), '../lib/amazon/mws.yml') )
11
+
12
+ AWS::MWS::Base.establish_connection!(
13
+ config['production']
14
+ )
15
+ AWS::MWS::Base.debug = true
16
+ end
17
+
18
+ def test_request
19
+ #response = Report.request(:flat_file_orders)
20
+
21
+ #result = Report.request(:flat_file_orders, :start_date => Time.now, :end_date => Time.now.iso8601)
22
+
23
+ result = Report.request_list
24
+
25
+ puts result.inspect
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,18 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require 'yaml'
3
+
4
+ AWS::MWS::Base.debug = true
5
+
6
+ class RequestTest < Test::Unit::TestCase
7
+ def setup
8
+ config = YAML.load_file( File.join(File.dirname(__FILE__), '../lib/amazon/mws.yml') )
9
+
10
+ @marketplace = AWS::MWS::Base.new(config['production'])
11
+ end
12
+
13
+ def test_first
14
+ response = @marketplace.request_report(:converged_flat_file_order_report)
15
+ response = @marketplace.get_report_request_list('MaxCount' => 100)
16
+ end
17
+
18
+ end
@@ -0,0 +1,197 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ include Amazon::MWS
4
+
5
+ class ResponseTest < Test::Unit::TestCase
6
+
7
+ def test_submit_feed_response
8
+ response = SubmitFeedResponse.format(xml_for('submit_feed'))
9
+
10
+ assert_equal(response.feed_submission.id, 2291326430)
11
+ assert_equal(response.feed_submission.feed_type, '_POST_PRODUCT_DATA_')
12
+ assert_equal(response.request_id, '75424a38-f333-4105-98f0-2aa9592d665c')
13
+ end
14
+
15
+ def test_feed_submission_list_response
16
+ response = GetFeedSubmissionListResponse.format(xml_for('get_feed_submission_list'))
17
+
18
+ assert_equal("1105b931-6f1c-4480-8e97-f3b467840a9e", response.request_id)
19
+ assert(response.has_next?)
20
+ assert_equal(response.next_token, "2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=")
21
+ assert_equal(response.feed_submissions.size, 1)
22
+ assert_equal(response.feed_submissions.first.id, 2291326430)
23
+ end
24
+
25
+ def test_get_feed_submission_list_by_next_token
26
+ response = GetFeedSubmissionListByNextTokenResponse.format(xml_for('get_feed_submission_list_by_next_token'))
27
+
28
+ assert_equal("1105b931-6f1c-4480-8e97-f3b467840a9e", response.request_id)
29
+ assert_equal(false, response.has_next?) # same as false ???
30
+ assert_equal('none', response.next_token)
31
+ assert_equal(response.feed_submissions.size, 1)
32
+ assert_equal(response.feed_submissions.first.id, 2291326430)
33
+ assert_equal('1105b931-6f1c-4480-8e97-f3b467840a9e', response.request_id)
34
+ end
35
+
36
+ def test_get_feed_submission_count
37
+ response = GetFeedSubmissionCountResponse.format(xml_for('get_feed_submission_count'))
38
+
39
+ assert_equal(463, response.count)
40
+ assert_equal('21e482a8-15c7-4da3-91a4-424995ed0756', response.request_id)
41
+ end
42
+
43
+ def test_cancel_feed_submissions
44
+ response = CancelFeedSubmissionsResponse.format(xml_for('cancel_feed_submissions'))
45
+
46
+ assert_equal(1, response.count)
47
+ assert_equal(1, response.feed_submissions.size)
48
+ assert_equal('18e78983-bbf9-43aa-a661-ae7696cb49d4', response.request_id)
49
+ end
50
+
51
+ def test_get_feed_submission_result
52
+ response = GetFeedSubmissionResultResponse.format(xml_for('get_feed_submission_result'))
53
+ assert_equal(1.02, response.document_version)
54
+ assert_equal('M_EXAMPLE_9876543210', response.merchant_id)
55
+
56
+ assert_equal('ProcessingReport', response.message_type)
57
+
58
+ assert_equal(1, response.message.id)
59
+ assert_equal(2060950676, response.message.document_transaction_id)
60
+ assert_equal("Complete", response.message.status_code)
61
+
62
+ assert_equal(0, response.message.processing_summary.messages_processed)
63
+ assert_equal(0, response.message.processing_summary.messages_successful)
64
+ assert_equal(1, response.message.processing_summary.messages_with_error)
65
+ assert_equal(0, response.message.processing_summary.messages_with_warning)
66
+
67
+ assert_equal(0, response.message.result.message_id)
68
+ assert_equal('Error', response.message.result.result_code)
69
+ assert_equal(6001, response.message.result.message_code)
70
+ assert_equal('XML parsing fatal error at line 1, column 1: Invalid document structure', response.message.result.description)
71
+ assert_equal(0, response.message.result.sku)
72
+ end
73
+
74
+ def test_request_report
75
+ response = RequestReportResponse.format(xml_for('request_report'))
76
+
77
+ assert_equal("88faca76-b600-46d2-b53c-0c8c4533e43a", response.request_id)
78
+
79
+ assert(response.report_request)
80
+ assert_equal(response.report_request.report_type, "_GET_MERCHANT_LISTINGS_DATA_")
81
+ assert_equal(response.report_request.scheduled?, false)
82
+ assert_equal(response.report_request.report_processing_status, "_SUBMITTED_")
83
+ end
84
+
85
+ def test_get_report_request_list
86
+ response = GetReportRequestListResponse.format(xml_for('get_report_request_list'))
87
+
88
+ assert_equal(response.request_id, "1e1d7b22-004e-4333-a881-1f20b671097f")
89
+ assert(response.has_next?)
90
+ assert_equal(response.next_token, "gTw92cRxgz0D2s1QD6a1Fdz+0b6t4r6aM48r5nOh7ZQ2cKWBkRSk57AfQiDLYYb/tts/YTgAGXw7u4xT348+ZoSJ8NeAlfpOrrBJpKO2HAHCv/LqsB0EzxybTwcKfw+6oQjX0m4upU+Q1A2v3FCYQ1eWYigAJMzhvZSqczZdpQRFrR1eNdlVGQ==")
91
+ assert_equal(response.report_requests.size, 10)
92
+ end
93
+
94
+ def test_get_report_request_list_by_next_token
95
+ response = GetReportRequestListByNextTokenResponse.format(xml_for('get_report_request_list_by_next_token'))
96
+
97
+ assert_equal("732480cb-84a8-4c15-9084-a46bd9a0889b", response.request_id)
98
+ assert_equal('none', response.next_token)
99
+ assert_equal(false, response.has_next?) # same as false ???
100
+
101
+ assert_equal(1, response.report_requests.size)
102
+ assert_equal(2291326454, response.report_requests.first.id)
103
+ assert_equal('732480cb-84a8-4c15-9084-a46bd9a0889b', response.request_id)
104
+ end
105
+
106
+ def test_get_report_request_count
107
+ response = GetReportRequestCountResponse.format(xml_for('get_report_request_count'))
108
+
109
+ assert_equal(1276, response.count)
110
+ assert_equal('7e155027-3741-4422-95a7-1de12703c13e', response.request_id)
111
+ end
112
+
113
+ def test_cancel_report_requests
114
+ response = CancelReportRequestsResponse.format(xml_for('cancel_report_requests'))
115
+
116
+ assert_equal(10, response.count)
117
+ assert_equal(1, response.report_requests.size)
118
+ assert_equal('a720f9d6-83e9-4684-bc35-065b41ed5ca4', response.request_id)
119
+ end
120
+
121
+ def test_get_report_list_response
122
+ response = GetReportListResponse.format(xml_for('get_report_list'))
123
+
124
+ assert_equal("fbf677c1-dcee-4110-bc88-2ba3702e331b", response.request_id)
125
+ assert(response.has_next?)
126
+ #assert_equal(response.next_token, "2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=")
127
+ assert_equal(response.reports.size, 1)
128
+
129
+ assert_equal(898899473, response.reports.first.id)
130
+ assert_equal('_GET_MERCHANT_LISTINGS_DATA_', response.reports.first.type)
131
+ assert_equal(2278662938, response.reports.first.report_request_id)
132
+ assert_equal(Time.parse('Tue Feb 10 04:22:33 -0500 2009'), response.reports.first.available_date)
133
+ assert_equal(response.reports.first.acknowledged?, false)
134
+ end
135
+
136
+ def test_get_report_count
137
+ response = GetReportCountResponse.format(xml_for('get_report_count'))
138
+
139
+ assert_equal(166, response.count)
140
+ assert_equal('a497aadb-5ea1-49bf-aa14-dabe914465e3', response.request_id)
141
+ end
142
+
143
+ def test_manage_report_schedule
144
+ response = ManageReportScheduleResponse.format(xml_for('manage_report_schedule'))
145
+
146
+ assert_equal(1, response.count)
147
+ assert_equal('7ee1bc50-5a13-4db1-afd7-1386e481984e', response.request_id)
148
+
149
+ assert(response.report_schedule)
150
+ assert_equal('_GET_ORDERS_DATA_', response.report_schedule.report_type)
151
+ assert_equal('_30_DAYS_', response.report_schedule.schedule)
152
+ assert_equal(Time.parse('2009-02-20T02:10:42+00:00'), response.report_schedule.scheduled_date)
153
+ end
154
+
155
+ def test_get_report_schedule_list_response
156
+ response = GetReportScheduleListResponse.format(xml_for('get_report_schedule_list'))
157
+
158
+ assert_equal("c0464157-b74f-4e52-bd1a-4ebf4bc7e5aa", response.request_id)
159
+ assert(response.has_next?)
160
+ assert_equal("4XgYW55IPQhcm5hbCBwbGVhc3VyZS4=", response.next_token)
161
+
162
+ assert_equal(response.report_schedules.size, 1)
163
+
164
+ assert_equal('_GET_ORDERS_DATA_', response.report_schedules[0].report_type)
165
+ assert_equal('_30_DAYS_', response.report_schedules[0].schedule)
166
+ assert_equal(Time.parse('2009-02-20T02:10:42+00:00'), response.report_schedules[0].scheduled_date)
167
+ end
168
+
169
+ def test_get_report_schedule_list_by_next_token
170
+ response = GetReportScheduleListByNextTokenResponse.format(xml_for('get_report_schedule_list_by_next_token'))
171
+
172
+ assert_equal("c0464157-b74f-4e52-bd1a-4ebf4bc7e5aa", response.request_id)
173
+ assert_equal('none', response.next_token)
174
+ assert_equal(false, response.has_next?) # same as false ???
175
+
176
+ assert_equal(1, response.report_schedules.size)
177
+ # assert_equal(13050620, response.report_schedules[0].id)
178
+ assert_equal('c0464157-b74f-4e52-bd1a-4ebf4bc7e5aa', response.request_id)
179
+ end
180
+
181
+ def test_get_report_schedule_count
182
+ response = GetReportScheduleCountResponse.format(xml_for('get_report_schedule_count'))
183
+
184
+ assert_equal(18, response.count)
185
+ assert_equal('21e482a8-15c7-4da3-91a4-424995ed0756', response.request_id)
186
+ end
187
+
188
+ def test_update_report_acknowledgements
189
+ response = UpdateReportAcknowledgementsResponse.format(xml_for('update_report_acknowledgements'))
190
+
191
+ assert_equal(1, response.count)
192
+ assert_equal('42a578a7-ed92-486b-ac67-5de7464fcdfa', response.request_id)
193
+ assert(response.reports)
194
+ end
195
+
196
+ end
197
+
@@ -0,0 +1,30 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class SignatureTest < Test::Unit::TestCase
4
+ def setup
5
+ @expected_base64 = "F8zvW31wDYENPZrwkVYaPOLHh2R+goZncb0SlwTwyes="
6
+ @expected_digest = "\027\314\357[}p\r\201\r=\232\360\221V\032<\342\307\207d~\202\206gq\275\022\227\004\360\311\353"
7
+ end
8
+
9
+ def test_sign_with_string_keys
10
+ signature = Amazon::MWS::Authentication::Signature.new(
11
+ {"devil" => "666"},
12
+ {:verb => :get, :secret_access_key => "beelzebub"}
13
+ )
14
+
15
+ # Not sure if this really helps, just locks it down
16
+ assert_equal(@expected_base64, signature)
17
+ assert_equal(@expected_digest, Base64.decode64(signature))
18
+ end
19
+
20
+ def test_sign_with_symbol_keys
21
+ signature = Amazon::MWS::Authentication::Signature.new(
22
+ {:devil => "666"},
23
+ {:verb => :get, :secret_access_key => "beelzebub"}
24
+ )
25
+
26
+ # Not sure if this really helps, just locks it down
27
+ assert_equal(@expected_base64, signature)
28
+ assert_equal(@expected_digest, Base64.decode64(signature))
29
+ end
30
+ end