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,67 @@
1
+ require 'set'
2
+
3
+ module Amazon
4
+ module MWS
5
+
6
+ class FeedBuilder
7
+ attr_accessor :xml
8
+
9
+ OPERATION_TYPES = Set.new([
10
+ "Update",
11
+ "Delete"
12
+ ])
13
+
14
+ def initialize(message_type, message = {}, params = {})
15
+ @xml = Builder::XmlMarkup.new
16
+ @message_type = message_type
17
+ @message = message
18
+ @params = params
19
+ end
20
+
21
+ def render
22
+ @xml.instruct!
23
+ @xml.AmazonEnvelope("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", "xsi:noNamespaceSchemaLocation"=>"amzn-envelope.xsd") do
24
+ render_envelope(:message_type => @message_type)
25
+ # header
26
+ render_header(@params)
27
+ # message
28
+ render_message(@message, @params)
29
+ end
30
+ end
31
+
32
+ def render_header(params = {})
33
+ @xml.Header do
34
+ @xml.MerchantIdentifier "merchant_id"
35
+ end
36
+ end
37
+
38
+ def render_envelope(params = {})
39
+ @xml.EffectiveDate Time.now
40
+ @xml.MessageID
41
+ @xml.MessageType(params[:message_type])
42
+ @xml.OperationType(params[:operation_type]) if params[:operation_type]
43
+ @xml.PurgeAndReplace(params[:purge] || false)
44
+ end
45
+
46
+ def render_message(message, params = {})
47
+ raise unless message.is_a? Hash
48
+
49
+ @xml.Message do |xml|
50
+ build_xml(message, xml)
51
+ end
52
+ end
53
+
54
+ def build_xml(hash, xml)
55
+ hash.each {|key, value|
56
+ case value
57
+ when Hash then xml.tag!(key) {|xml| build_xml(value, xml) }
58
+ when Array then xml.tag!(key) {|xml| value.each {|v| build_xml(v, xml) } }
59
+ else xml.tag!(key, value)
60
+ end
61
+ }
62
+ end
63
+ end
64
+ # Feed
65
+
66
+ end
67
+ end
@@ -0,0 +1,46 @@
1
+ module Amazon
2
+ module MWS
3
+ module Feed
4
+
5
+ module Enumerations
6
+
7
+ # Note: We do not handle flat file feed types
8
+ FEED_TYPES = {
9
+ :product_data => '_POST_PRODUCT_DATA_',
10
+ :product_relationship_data => '_POST_PRODUCT_RELATIONSHIP_DATA_',
11
+ :item_data => '_POST_ITEM_DATA_',
12
+ :product_overrides => '_POST_PRODUCT_OVERRIDES_DATA_',
13
+ :product_image_data => '_POST_PRODUCT_IMAGE_DATA_',
14
+ :product_pricing => '_POST_PRODUCT_PRICING_DATA_',
15
+ :inventory_availability => '_POST_INVENTORY_AVAILABILITY_DATA_',
16
+ :order_acknowledgement => '_POST_ORDER_ACKNOWLEDGEMENT_DATA_',
17
+ :order_fulfillment => '_POST_ORDER_FULFILLMENT_DATA_',
18
+ :payment_adjustment => '_POST_PAYMENT_ADJUSTMENT_DATA_',
19
+ # :flat_file_listings => '_POST_FLAT_FILE_LISTINGS_DATA_',
20
+ # :flat_file_order_acknowledgement => '_POST_FLAT_FILE_ORDER_ACKNOWLEDGEMENT_DATA_',
21
+ # :flat_file_fulfillment_data => '_POST_FLAT_FILE_FULFILLMENT_DATA_',
22
+ # :flat_file_payment_adjustment => '_POST_FLAT_FILE_PAYMENT_ADJUSTMENT_DATA_',
23
+ # :flat_file_invloader => '_POST_FLAT_FILE_INVLOADER_DATA_'
24
+ }
25
+
26
+ MESSAGE_TYPES = [
27
+ "FulfillmentCenter",
28
+ "Inventory",
29
+ "OrderAcknowledgment",
30
+ "OrderAdjustment",
31
+ "OrderFulfillment",
32
+ "OrderReport",
33
+ "Override",
34
+ "Price",
35
+ "ProcessingReport",
36
+ "Product",
37
+ "ProductImage",
38
+ "Relationship",
39
+ "SettlementReport"
40
+ ]
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class FeedSubmission < Response
5
+ xml_name "FeedSubmissionInfo"
6
+
7
+ xml_reader :id, :from => "FeedSubmissionId", :as => Integer
8
+ xml_reader :feed_type
9
+ xml_reader :submitted_date, :as => Time
10
+ xml_reader :feed_processing_status
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,162 @@
1
+ class String
2
+ if RUBY_VERSION >= '1.9'
3
+ def valid_utf8?
4
+ dup.force_encoding('UTF-8').valid_encoding?
5
+ end
6
+ else
7
+ def valid_utf8?
8
+ scan(Regexp.new('[^\x00-\xa0]', nil, 'u')) { |s| s.unpack('U') }
9
+ true
10
+ rescue ArgumentError
11
+ false
12
+ end
13
+ end
14
+
15
+ def to_boolean
16
+ (self == "true") ? true : false
17
+ end
18
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+
19
+ # is set to <tt>:lower</tt> then +camelize+ produces lowerCamelCase.
20
+ #
21
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
22
+ #
23
+ # Examples:
24
+ # "active_record".camelize # => "ActiveRecord"
25
+ # "active_record".camelize(:lower) # => "activeRecord"
26
+ # "active_record/errors".camelize # => "ActiveRecord::Errors"
27
+ # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
28
+ def camelize(first_letter_in_uppercase = true)
29
+ if first_letter_in_uppercase
30
+ self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
31
+ else
32
+ self.to_s.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
33
+ end
34
+ end
35
+
36
+ def underscore
37
+ self.gsub(/::/, '/').
38
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
39
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
40
+ tr("-", "_").
41
+ downcase
42
+ end
43
+ end
44
+
45
+ class Hash
46
+ def self.from_query_string(string)
47
+ query = string.split(/\?/)[-1]
48
+ parts = query.split(/&|=/)
49
+ Hash[*parts]
50
+ end
51
+
52
+ #take keys of hash and transform those to a symbols
53
+ def self.keys_to_s(value)
54
+ return value if not value.is_a?(Hash)
55
+ hash = value.inject({}){|memo,(k,v)| memo[k.to_s] = Hash.keys_to_s(v); memo}
56
+ return hash
57
+ end
58
+
59
+ end
60
+
61
+ class Array
62
+ def extract_options!
63
+ last.is_a?(::Hash) ? pop : {}
64
+ end
65
+
66
+ def to_query_string
67
+ self.map { |k| "%s=%s" % [URI.encode(k[0].to_s), URI.encode(k[1].to_s)] }.join('&') unless self.empty?
68
+ end
69
+ end
70
+
71
+ class Hash
72
+ def to_query_string
73
+ self.map { |k,v| "%s=%s" % [URI.encode(k.to_s), URI.encode(v.to_s)] }.join('&') unless self.empty?
74
+ end
75
+ end
76
+
77
+ class Object
78
+ def returning(value)
79
+ yield(value)
80
+ value
81
+ end
82
+ end
83
+
84
+ module Kernel
85
+ def __method__(depth = 0)
86
+ caller[depth][/`([^']+)'/, 1]
87
+ end if RUBY_VERSION <= '1.8.7'
88
+
89
+ def __called_from__
90
+ caller[1][/`([^']+)'/, 1]
91
+ end if RUBY_VERSION > '1.8.7'
92
+
93
+ def expirable_memoize(reload = false, storage = nil)
94
+ current_method = RUBY_VERSION > '1.8.7' ? __called_from__ : __method__(1)
95
+ storage = "@#{storage || current_method}"
96
+ if reload
97
+ instance_variable_set(storage, nil)
98
+ else
99
+ if cache = instance_variable_get(storage)
100
+ return cache
101
+ end
102
+ end
103
+ instance_variable_set(storage, yield)
104
+ end
105
+
106
+ def require_library_or_gem(library, gem_name = nil)
107
+ if RUBY_VERSION >= '1.9'
108
+ gem(gem_name || library, '>=0')
109
+ end
110
+ require library
111
+ rescue LoadError => library_not_installed
112
+ begin
113
+ require 'rubygems'
114
+ require library
115
+ rescue LoadError
116
+ raise library_not_installed
117
+ end
118
+ end
119
+ end
120
+
121
+ class Class # :nodoc:
122
+ def cattr_reader(*syms)
123
+ syms.flatten.each do |sym|
124
+ class_eval(<<-EOS, __FILE__, __LINE__)
125
+ unless defined? @@#{sym}
126
+ @@#{sym} = nil
127
+ end
128
+
129
+ def self.#{sym}
130
+ @@#{sym}
131
+ end
132
+
133
+ def #{sym}
134
+ @@#{sym}
135
+ end
136
+ EOS
137
+ end
138
+ end
139
+
140
+ def cattr_writer(*syms)
141
+ syms.flatten.each do |sym|
142
+ class_eval(<<-EOS, __FILE__, __LINE__)
143
+ unless defined? @@#{sym}
144
+ @@#{sym} = nil
145
+ end
146
+
147
+ def self.#{sym}=(obj)
148
+ @@#{sym} = obj
149
+ end
150
+
151
+ def #{sym}=(obj)
152
+ @@#{sym} = obj
153
+ end
154
+ EOS
155
+ end
156
+ end
157
+
158
+ def cattr_accessor(*syms)
159
+ cattr_reader(*syms)
160
+ cattr_writer(*syms)
161
+ end
162
+ end if Class.instance_methods(false).grep(/^cattr_(?:reader|writer|accessor)$/).empty?
@@ -0,0 +1,10 @@
1
+ module Memoizable
2
+ def memoize( name, cache = Hash.new )
3
+ original = "__unmemoized_#{name}__"
4
+ ([Class, Module].include?(self.class) ? self : self.class).class_eval do
5
+ alias_method original, name
6
+ private original
7
+ define_method(name) { |*args| cache[args] ||= send(original, *args) }
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ class Orders
5
+
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,310 @@
1
+ module Amazon
2
+ module MWS
3
+
4
+ module Report
5
+ include Enumerations
6
+ # class << self
7
+
8
+ # The RequestReport operation requests the generation of a report, which
9
+ # creates a report request. Reports are retained for 90 days.
10
+ # Required Request Parameters
11
+ # ReportType - The type of report to request.
12
+ #
13
+ # Optional Request Parameters
14
+ # StartDate - Start of a date range used for selecting the data to report.
15
+ # EndDate - End of a date range used for selecting the data to report.
16
+
17
+ def request_report(report_type, params ={})
18
+ raise InvalidReportType if !REPORT_TYPES.include?(report_type)
19
+ # These may need to be processed
20
+ start_date = params[:start_date]
21
+ end_date = params[:end_date]
22
+
23
+ query_params = {
24
+ "Action" => "RequestReport",
25
+ "ReportType" => REPORT_TYPES[report_type]
26
+ }
27
+
28
+ query_params.merge!({"StartDate" => start_date}) if start_date
29
+ query_params.merge!({"EndDate" => end_date}) if end_date
30
+
31
+ response = get("/", query_params)
32
+
33
+ RequestReportResponse.format(response)
34
+ end
35
+
36
+ # GetReportRequestList
37
+ # --------------------
38
+ # The GetReportRequestList operation returns a list of report requests
39
+ # that match the query parameters.
40
+ #
41
+ # Amazon MWS limits calls to 1,000 total calls per hour per seller
42
+ # account, including calls to GetReportRequestList.
43
+ #
44
+ # The maximum number of results that will be returned in one call is one
45
+ # hundred. If there are additional results to return, HasNext will be
46
+ # returned in the response with a true value. To retrieve all the
47
+ # results, you can use the value of the NextToken parameter to call
48
+ # GetReportRequestListByNextToken until HasNext is false.
49
+
50
+ # Optional Request Parameters
51
+ #
52
+ # ReportRequestIdList - A structured list of report request IDs. If you
53
+ # pass in explicit IDs in this call, the other conditions, if specified,
54
+ # will be ignored.
55
+ #
56
+ # ReportTypeList - A structured ReportType list by which to filter
57
+ # reports.
58
+ #
59
+ # ReportProcessingStatusList -A structured list of report processing
60
+ # statuses by which to filter report requests.
61
+ #
62
+ # ReportProcessingStatus values:
63
+ #
64
+ # _SUBMITTED_
65
+ # _IN_PROGRESS_
66
+ # _CANCELLED_
67
+ # _DONE_
68
+ # _DONE_NO_DATA_
69
+ #
70
+ # MaxCount - Maximum number of reports to return in the list. If you
71
+ # specify a number greater than 100, the call will be rejected.
72
+ #
73
+ # RequestedFromDate - The earliest date you are looking for, in ISO8601
74
+ # date format (for example, "2008-07-03T18:12:22Z" or
75
+ # "2008-07-03T18:12:22.093-07:00").
76
+ #
77
+ # RequestedToDate - The most recent date you are looking for.
78
+
79
+ def get_report_request_list(params = {})
80
+ response = get("/", {"Action" => "GetReportRequestList"}.merge(params))
81
+ GetReportRequestListResponse.format(response)
82
+ end
83
+ # add a nice method
84
+ alias_method :report_request_list, :get_report_request_list
85
+
86
+ # GetReportRequestListByNextToken
87
+ # Description
88
+ #
89
+ # The GetReportRequestListByNextToken operation returns a list of report
90
+ # requests that match the query parameters, using the NextToken, which
91
+ # was supplied by a previous call to either
92
+ # GetReportRequestListByNextToken or a call to GetReportRequestList,
93
+ # where the value of HasNext was true in that previous call.
94
+
95
+ # NextToken
96
+ # Token returned in a previous call to either GetReportRequestList or
97
+ # GetReportRequestListByNextToken when the value of HasNext was true.
98
+
99
+ def get_report_request_list_by_next_token(next_token)
100
+ response =
101
+ post("/", {
102
+ "Action" => "GetReportRequestListByNextToken",
103
+ "NextToken" => next_token
104
+ })
105
+
106
+ GetReportRequestListByNextTokenResponse.format(response)
107
+ end
108
+
109
+ alias_method :report_request_list_by_next_token, :get_report_request_list_by_next_token
110
+
111
+ # GetReportRequestCount
112
+ # The GetReportRequestCount returns a count of report requests.
113
+
114
+ def get_report_request_count(params = {})
115
+ response = get("/", {"Action" => "GetReportRequestCount"})
116
+ GetReportRequestCountResponse.format(response)
117
+ end
118
+ # add a nice method
119
+ alias_method :report_request_count, :get_report_request_count
120
+
121
+ # CancelReportRequests
122
+ # The CancelReportRequests operation cancels one or more report
123
+ # requests, returning the count of the canceled report requests and the
124
+ # report request information. You can specify a number to cancel of
125
+ # greater than one hundred, but information will only be returned about
126
+ # the first one hundred report requests in the list. To return metadata
127
+ # about a greater number of canceled report requests, you can call
128
+ # GetReportRequestList. If report requests have already begun
129
+ # processing, they cannot be canceled.
130
+
131
+ #
132
+ # ReportRequestIdList
133
+ # A structured list of report request IDs. If you pass in explicit IDs in this call, the other conditions, if specified, will be ignored.
134
+ #
135
+ # ReportTypeList
136
+ # A structured ReportType list by which to filter reports.
137
+ #
138
+ # ReportProcessingStatusList
139
+ # A structured list of report processing statuses by which to filter report requests.
140
+ #
141
+ # ReportProcessingStatus
142
+ # _SUBMITTED_
143
+ # _IN_PROGRESS_
144
+ # _CANCELLED_
145
+ # _DONE_
146
+ # _DONE_NO_DATA_
147
+ #
148
+ # RequestedFromDate
149
+ # The earliest date you are looking for, in ISO8601 date format (for example, "2008-07-03T18:12:22Z" or "2008-07-03T18:12:22.093-07:00").
150
+ #
151
+ # RequestedToDate
152
+ # The most recent date you are looking for.
153
+
154
+ def cancel_report_requests(params = {})
155
+ response = get("/", {"Action" => "CancelReportRequests"}.merge(params))
156
+ CancelReportRequestsResponse.format(response)
157
+ end
158
+
159
+ # GetReportList
160
+ # The GetReportList operation returns a list of reports within the
161
+ # previous 90 days that match the query parameters. The maximum number
162
+ # of results that will be returned in one call is one hundred. If there
163
+ # are additional results to return, HasNext will be returned in the
164
+ # response with a true value. To retrieve all the results, you can use
165
+ # the value of the NextToken parameter to call GetReportListByNextToken
166
+ # until HasNext is false.
167
+ #
168
+ # Request Parameters
169
+
170
+ def get_report_list(params = {})
171
+ response = get("/", {"Action" => "GetReportList"}.merge(params))
172
+ GetReportListResponse.format(response)
173
+ end
174
+
175
+ alias_method :report_list, :get_report_list
176
+
177
+ # GetReportCount
178
+ # The GetReportCount operation returns a count of reports within the
179
+ # previous 90 days that are available for the seller to download.
180
+
181
+ # ReportTypeList
182
+ # A structured ReportType list by which to filter reports.
183
+ #
184
+ # Acknowledged
185
+ # Set to true to list reports that have been acknowledged with a prior
186
+ # call to UpdateReportAcknowledgements. Set to false to list reports
187
+ # that have not been acknowledged.
188
+ #
189
+ # AvailableFromDate
190
+ # The earliest date you are looking for, in ISO8601 date format (for
191
+ # example, "2008-07-03T18:12:22Z" or "2008-07-03T18:12:22.093-07:00").
192
+ #
193
+ # AvailableToDate
194
+ # The most recent date you are looking for.
195
+
196
+ def get_report_count(params = {})
197
+ response = get("/", {"Action" => "GetReportCount"})
198
+ GetReportCountResponse.format(response)
199
+ end
200
+
201
+ alias_method :report_count, :get_report_count
202
+
203
+ # GetReport
204
+ # Description
205
+ #
206
+ # The GetReport operation returns the contents of a report and the
207
+ # Content-MD5 header for the returned body. Reports are retained for 90
208
+ # days from the time they have been generated.
209
+ #
210
+ # Amazon MWS limits calls to 1,000 total calls per hour per seller
211
+ # account, including a limit of 60 calls per hour to GetReport.
212
+ #
213
+ # You should compute the MD5 hash of the HTTP body and compare that with
214
+ # the returned Content-MD5 header value. If they do not match, which
215
+ # means the body was corrupted during transmission, you should discard
216
+ # the result and automatically retry the call for up to three more
217
+ # times. Please notify us if you ever see such a corrupted body. You can
218
+ # contact us by using the contact form at http://mws.amazon.com
219
+ # (http://mws.amazon.com). For more information, see Using the
220
+ # Content-MD5 Header with SubmitFeed.
221
+ #
222
+
223
+ def get_report(report_id, params = {})
224
+ response = get("/", {"Action" => "GetReport", "ReportId" => report_id})
225
+ # TODO format response
226
+ end
227
+ alias_method :report, :get_report
228
+
229
+ # ManageReportSchedule
230
+ # The ManageReportSchedule operation creates, updates, or deletes a
231
+ # report schedule for a particular report type. Currently, only order
232
+ # reports can be scheduled.
233
+ #
234
+ # Request Parameters
235
+ #
236
+ # ReportType
237
+ # The type of reports that you want to schedule generation of.
238
+ # Currently, only order reports can be scheduled.
239
+ #
240
+ # Schedule
241
+ # A string that describes how often a ReportRequest should be created.
242
+ # The list of enumerated values is found in the enumeration topic,
243
+ # Schedule.
244
+ #
245
+ # ScheduledDate
246
+ # The date when the next report is scheduled to run. Limited to no more
247
+ # than 366 days in the future.
248
+
249
+ def manage_report_schedule(report_type, schedule, params={})
250
+ raise InvalidReportType if !REPORT_TYPES.include?(report_type)
251
+ raise InvalidSchedule if !SCHEDULE.include?(schedule)
252
+
253
+ response =
254
+ get("/", {
255
+ "Action" => "ManageReportSchedule",
256
+ "Schedule" => schedule,
257
+ "ReportType" => report_type
258
+ })
259
+
260
+ ManageReportScheduleResponse.format(reponse)
261
+ end
262
+
263
+ # GetReportScheduleList
264
+ # The GetReportScheduleList operation returns a list of report schedules
265
+ # that match the query parameters. Currently, only order reports can be
266
+ # scheduled.
267
+ #
268
+ # The maximum number of results that will be returned in one call is one
269
+ # hundred. If there are additional results to return, HasNext will be
270
+ # returned in the response with a true value. To retrieve all the
271
+ # results, you can use the value of the NextToken parameter to call
272
+ # GetReportScheduleListByNextToken until HasNext is false.
273
+ # [Note] Note
274
+ #
275
+ # For this release of Amazon MWS, only order reports can be scheduled,
276
+ # so HasNext will always be False.
277
+
278
+
279
+ def get_report_schedule_list(params = {})
280
+ response = get("/", {"Action" => "GetReportScheduleList"}.merge(params))
281
+ GetReportScheduleListResponse.format(response)
282
+ end
283
+
284
+ alias_method :report_schedule_list, :get_report_schedule_list
285
+
286
+
287
+ def get_report_schedule_list_by_next_token(next_token)
288
+ response =
289
+ get("/", {
290
+ "Action" => "GetReportScheduleListByNextToken",
291
+ "NextToken" => next_token
292
+ })
293
+
294
+ GetReportScheduleListByNextTokenResponse.format(response)
295
+ end
296
+
297
+ alias_method :report_schedule_list_by_next_token, :get_report_schedule_list_by_next_token
298
+
299
+ def get_report_schedule_count(params = {})
300
+ response = get("/", {"Action" => "GetReportScheduleCount"})
301
+ GetReportScheduleCountResponse.format(response)
302
+ end
303
+
304
+ alias_method :report_schedule_count, :get_report_schedule_count
305
+
306
+ end
307
+
308
+ # end
309
+ end
310
+ end