peddler 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +15 -14
  4. data/lib/mws/cart_information/client.rb +72 -0
  5. data/lib/mws/cart_information.rb +1 -69
  6. data/lib/mws/customer_information/client.rb +79 -0
  7. data/lib/mws/customer_information.rb +1 -77
  8. data/lib/mws/feeds/client.rb +112 -0
  9. data/lib/mws/feeds.rb +1 -110
  10. data/lib/mws/fulfillment_inbound_shipment/client.rb +233 -0
  11. data/lib/mws/fulfillment_inbound_shipment.rb +1 -231
  12. data/lib/mws/fulfillment_inventory/client.rb +53 -0
  13. data/lib/mws/fulfillment_inventory.rb +1 -51
  14. data/lib/mws/fulfillment_outbound_shipment/client.rb +171 -0
  15. data/lib/mws/fulfillment_outbound_shipment.rb +1 -168
  16. data/lib/mws/off_amazon_payments/client.rb +362 -0
  17. data/lib/mws/off_amazon_payments.rb +1 -360
  18. data/lib/mws/orders/client.rb +102 -0
  19. data/lib/mws/orders.rb +1 -98
  20. data/lib/mws/products/client.rb +234 -0
  21. data/lib/mws/products.rb +1 -232
  22. data/lib/mws/recommendations/client.rb +71 -0
  23. data/lib/mws/recommendations.rb +1 -66
  24. data/lib/mws/reports/client.rb +220 -0
  25. data/lib/mws/reports.rb +1 -220
  26. data/lib/mws/sellers/client.rb +42 -0
  27. data/lib/mws/sellers.rb +1 -40
  28. data/lib/mws/subscriptions/client.rb +177 -0
  29. data/lib/mws/subscriptions.rb +1 -169
  30. data/lib/mws.rb +2 -2
  31. data/lib/peddler/client.rb +3 -3
  32. data/lib/peddler/flat_file_parser.rb +3 -3
  33. data/lib/peddler/operation.rb +2 -3
  34. data/lib/peddler/structured_list.rb +1 -3
  35. data/lib/peddler/version.rb +1 -1
  36. data/lib/peddler/xml_parser.rb +1 -1
  37. data/test/integration/test_cart_information.rb +2 -2
  38. data/test/integration/test_customer_information.rb +2 -2
  39. data/test/integration/test_feeds.rb +2 -2
  40. data/test/integration/test_fulfillment_inbound_shipment.rb +2 -2
  41. data/test/integration/test_fulfillment_inventory.rb +3 -7
  42. data/test/integration/test_fulfillment_outbound_shipment.rb +2 -49
  43. data/test/integration/test_off_amazon_payments.rb +2 -2
  44. data/test/integration/test_orders.rb +2 -13
  45. data/test/integration/test_products.rb +2 -2
  46. data/test/integration/test_recommendations.rb +2 -11
  47. data/test/integration/test_reports.rb +2 -3
  48. data/test/integration/test_sellers.rb +2 -9
  49. data/test/integration/test_subscriptions.rb +2 -2
  50. data/test/integration_test_helper.rb +49 -0
  51. data/test/mws.yml +16 -0
  52. data/test/mws.yml.bak +16 -0
  53. data/test/test_helper.rb +7 -0
  54. data/test/unit/mws/test_off_amazon_payments_client.rb +9 -0
  55. data/test/unit/mws/test_products_client.rb +9 -0
  56. data/test/unit/peddler/test_client.rb +2 -2
  57. data/test/unit/peddler/test_flat_file_parser.rb +2 -2
  58. data/test/unit/peddler/test_operation.rb +2 -2
  59. data/test/unit/peddler/test_parser.rb +2 -2
  60. data/test/unit/peddler/test_structured_list.rb +2 -2
  61. data/test/unit/peddler/test_xml_parser.rb +2 -2
  62. data/test/unit/test_mws.rb +3 -3
  63. data/test/vcr_cassettes/CartInformation.yml +37 -725
  64. data/test/vcr_cassettes/CustomerInformation.yml +37 -728
  65. data/test/vcr_cassettes/Feeds.yml +100 -528
  66. data/test/vcr_cassettes/FulfillmentInboundShipment.yml +39 -728
  67. data/test/vcr_cassettes/FulfillmentInventory.yml +96 -997
  68. data/test/vcr_cassettes/FulfillmentOutboundShipment.yml +39 -725
  69. data/test/vcr_cassettes/OffAmazonPayments.yml +36 -727
  70. data/test/vcr_cassettes/Orders.yml +38 -29855
  71. data/test/vcr_cassettes/Products.yml +1300 -3871
  72. data/test/vcr_cassettes/Recommendations.yml +8934 -15590
  73. data/test/vcr_cassettes/Reports.yml +288 -1326
  74. data/test/vcr_cassettes/Sellers.yml +38 -1178
  75. data/test/vcr_cassettes/Subscriptions.yml +244 -1066
  76. metadata +27 -98
  77. data/test/helper.rb +0 -3
  78. data/test/integration_helper.rb +0 -49
  79. data/test/mws.yml.1 +0 -32
  80. data/test/mws.yml.example +0 -4
  81. data/test/unit/mws/test_off_amazon_payments.rb +0 -9
  82. data/test/unit/mws/test_products.rb +0 -9
@@ -0,0 +1,177 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Subscriptions
5
+ # The Amazon MWS Subscriptions API section enables you to subscribe to
6
+ # receive notifications that are relevant to your business with Amazon. With
7
+ # the operations in the Subscriptions API section, you can register to
8
+ # receive important information from Amazon without having to poll the
9
+ # Amazon MWS service. Instead, the information is sent directly to you when
10
+ # an event occurs to which you are subscribed.
11
+ class Client < ::Peddler::Client
12
+ path '/Subscriptions/2013-07-01'
13
+
14
+ # Registers a new destination to receive notifications
15
+ #
16
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_RegisterDestination.html
17
+ # @param sqs_queue_url [String]
18
+ # @param marketplace_id [String]
19
+ # @return [Peddler::XMLParser]
20
+ def register_destination(sqs_queue_url, marketplace_id = marketplace_id)
21
+ operation('RegisterDestination')
22
+ .add('MarketplaceId' => marketplace_id)
23
+ .add(build_destination(sqs_queue_url))
24
+
25
+ run
26
+ end
27
+
28
+ # Removes an existing destination from the list of registered destinations
29
+ #
30
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeregisterDestination.html
31
+ # @param sqs_queue_url [String]
32
+ # @param marketplace_id [String]
33
+ # @return [Peddler::XMLParser]
34
+ def deregister_destination(sqs_queue_url, marketplace_id = marketplace_id)
35
+ operation('DeregisterDestination')
36
+ .add('MarketplaceId' => marketplace_id)
37
+ .add(build_destination(sqs_queue_url))
38
+
39
+ run
40
+ end
41
+
42
+ # Lists all registered destinations
43
+ #
44
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html
45
+ # @param marketplace_id [String]
46
+ # @return [Peddler::XMLParser]
47
+ def list_registered_destinations(marketplace_id = marketplace_id)
48
+ operation('ListRegisteredDestinations')
49
+ .add('MarketplaceId' => marketplace_id)
50
+
51
+ run
52
+ end
53
+
54
+ # Sends a test notification to an existing destination
55
+ #
56
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_SendTestNotificationToDestination.html
57
+ # @param sqs_queue_url [String]
58
+ # @param marketplace_id [String]
59
+ # @return [Peddler::XMLParser]
60
+ def send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id)
61
+ operation('SendTestNotificationToDestination')
62
+ .add('MarketplaceId' => marketplace_id)
63
+ .add(build_destination(sqs_queue_url))
64
+
65
+ run
66
+ end
67
+
68
+ # Creates a new subscription
69
+ #
70
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_CreateSubscription.html
71
+ # @param notification_type [String]
72
+ # @param sqs_queue_url [String]
73
+ # @param marketplace_id [String]
74
+ # @return [Peddler::XMLParser]
75
+ def create_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
76
+ operation('CreateSubscription')
77
+ .add('MarketplaceId' => marketplace_id)
78
+ .add(build_subscription(notification_type, sqs_queue_url))
79
+
80
+ run
81
+ end
82
+
83
+ # Gets a subscription
84
+ #
85
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetSubscription.html
86
+ # @param notification_type [String]
87
+ # @param sqs_queue_url [String]
88
+ # @param marketplace_id [String]
89
+ # @return [Peddler::XMLParser]
90
+ def get_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
91
+ operation('GetSubscription')
92
+ .add(
93
+ 'MarketplaceId' => marketplace_id,
94
+ 'NotificationType' => notification_type
95
+ )
96
+ .add(build_destination(sqs_queue_url))
97
+
98
+ run
99
+ end
100
+
101
+ # Deletes a subscription
102
+ #
103
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeleteSubscription.html
104
+ # @param notification_type [String]
105
+ # @param sqs_queue_url [String]
106
+ # @param marketplace_id [String]
107
+ # @return [Peddler::XMLParser]
108
+ def delete_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
109
+ operation('DeleteSubscription')
110
+ .add(
111
+ 'MarketplaceId' => marketplace_id,
112
+ 'NotificationType' => notification_type
113
+ )
114
+ .add(build_destination(sqs_queue_url))
115
+
116
+ run
117
+ end
118
+
119
+ # Lists current subscriptions
120
+ #
121
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListSubscriptions.html
122
+ # @param marketplace_id [String]
123
+ # @return [Peddler::XMLParser]
124
+ def list_subscriptions(marketplace_id = marketplace_id)
125
+ operation('ListSubscriptions')
126
+ .add('MarketplaceId' => marketplace_id)
127
+
128
+ run
129
+ end
130
+
131
+ # Updates a subscription
132
+ #
133
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_UpdateSubscription.html
134
+ # @param notification_type [String]
135
+ # @param sqs_queue_url [String]
136
+ # @param enabled [Boolean]
137
+ # @param marketplace_id [String]
138
+ # @return [Peddler::XMLParser]
139
+ def update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id)
140
+ operation('CreateSubscription')
141
+ .add('MarketplaceId' => marketplace_id)
142
+ .add(build_subscription(notification_type, sqs_queue_url, enabled))
143
+
144
+ run
145
+ end
146
+
147
+ # Gets the service status of the API
148
+ #
149
+ # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetServiceStatus.html
150
+ # @return [Peddler::XMLParser]
151
+ def get_service_status
152
+ operation('GetServiceStatus')
153
+ run
154
+ end
155
+
156
+ private
157
+
158
+ def build_destination(sqs_queue_url)
159
+ {
160
+ 'Destination.DeliveryChannel' => 'SQS',
161
+ 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
162
+ 'Destination.AttributeList.member.1.Value' => sqs_queue_url
163
+ }
164
+ end
165
+
166
+ def build_subscription(notification_type, sqs_queue_url, enabled = true)
167
+ {
168
+ 'Subscription.IsEnabled' => enabled,
169
+ 'Subscription.NotificationType' => notification_type,
170
+ 'Subscription.Destination.DeliveryChannel' => 'SQS',
171
+ 'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
172
+ 'Subscription.Destination.AttributeList.member.1.Value' => sqs_queue_url
173
+ }
174
+ end
175
+ end
176
+ end
177
+ end
@@ -1,169 +1 @@
1
- require 'peddler/client'
2
-
3
- module MWS
4
- # The Amazon MWS Subscriptions API section enables you to subscribe to
5
- # receive notifications that are relevant to your business with Amazon. With
6
- # the operations in the Subscriptions API section, you can register to
7
- # receive important information from Amazon without having to poll the
8
- # Amazon MWS service. Instead, the information is sent directly to you when
9
- # an event occurs to which you are subscribed.
10
- class Subscriptions < ::Peddler::Client
11
- path '/Subscriptions/2013-07-01'
12
-
13
- # Registers a new destination to receive notifications
14
- #
15
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_RegisterDestination.html
16
- # @param sqs_queue_url [String]
17
- # @param marketplace_id [String]
18
- # @return [Peddler::XMLParser]
19
- def register_destination(sqs_queue_url, marketplace_id = marketplace_id)
20
- operation('RegisterDestination')
21
- .add('MarketplaceId' => marketplace_id)
22
- .add(build_destination(sqs_queue_url))
23
-
24
- run
25
- end
26
-
27
- # Removes an existing destination from the list of registered destinations
28
- #
29
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeregisterDestination.html
30
- # @param sqs_queue_url [String]
31
- # @param marketplace_id [String]
32
- # @return [Peddler::XMLParser]
33
- def deregister_destination(sqs_queue_url, marketplace_id = marketplace_id)
34
- operation('DeregisterDestination')
35
- .add('MarketplaceId' => marketplace_id)
36
- .add(build_destination(sqs_queue_url))
37
-
38
- run
39
- end
40
-
41
- # Lists all registered destinations
42
- #
43
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListRegisteredDestinations.html
44
- # @param marketplace_id [String]
45
- # @return [Peddler::XMLParser]
46
- def list_registered_destinations( marketplace_id = marketplace_id)
47
- operation('ListRegisteredDestinations')
48
- .add('MarketplaceId' => marketplace_id)
49
-
50
- run
51
- end
52
-
53
- # Sends a test notification to an existing destination
54
- #
55
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_SendTestNotificationToDestination.html
56
- # @param sqs_queue_url [String]
57
- # @param marketplace_id [String]
58
- # @return [Peddler::XMLParser]
59
- def send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id)
60
- operation('SendTestNotificationToDestination')
61
- .add('MarketplaceId' => marketplace_id)
62
- .add(build_destination(sqs_queue_url))
63
-
64
- run
65
- end
66
-
67
- # Creates a new subscription
68
- #
69
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_CreateSubscription.html
70
- # @param notification_type [String]
71
- # @param sqs_queue_url [String]
72
- # @param marketplace_id [String]
73
- # @return [Peddler::XMLParser]
74
- def create_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
75
- operation('CreateSubscription')
76
- .add('MarketplaceId' => marketplace_id)
77
- .add(build_subscription(notification_type, sqs_queue_url))
78
-
79
- run
80
- end
81
-
82
- # Gets a subscription
83
- #
84
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetSubscription.html
85
- # @param notification_type [String]
86
- # @param sqs_queue_url [String]
87
- # @param marketplace_id [String]
88
- # @return [Peddler::XMLParser]
89
- def get_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
90
- operation('GetSubscription')
91
- .add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
92
- .add(build_destination(sqs_queue_url))
93
-
94
- run
95
- end
96
-
97
- # Deletes a subscription
98
- #
99
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_DeleteSubscription.html
100
- # @param notification_type [String]
101
- # @param sqs_queue_url [String]
102
- # @param marketplace_id [String]
103
- # @return [Peddler::XMLParser]
104
- def delete_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
105
- operation('DeleteSubscription')
106
- .add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
107
- .add(build_destination(sqs_queue_url))
108
-
109
- run
110
- end
111
-
112
- # Lists current subscriptions
113
- #
114
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_ListSubscriptions.html
115
- # @param marketplace_id [String]
116
- # @return [Peddler::XMLParser]
117
- def list_subscriptions(marketplace_id = marketplace_id)
118
- operation('ListSubscriptions')
119
- .add('MarketplaceId' => marketplace_id)
120
-
121
- run
122
- end
123
-
124
- # Updates a subscription
125
- #
126
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_UpdateSubscription.html
127
- # @param notification_type [String]
128
- # @param sqs_queue_url [String]
129
- # @param enabled [Boolean]
130
- # @param marketplace_id [String]
131
- # @return [Peddler::XMLParser]
132
- def update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id)
133
- operation('CreateSubscription')
134
- .add('MarketplaceId' => marketplace_id)
135
- .add(build_subscription(notification_type, sqs_queue_url, enabled))
136
-
137
- run
138
- end
139
-
140
- # Gets the service status of the API
141
- #
142
- # @see http://docs.developer.amazonservices.com/en_US/subscriptions/Subscriptions_GetServiceStatus.html
143
- # @return [Peddler::XMLParser]
144
- def get_service_status
145
- operation('GetServiceStatus')
146
- run
147
- end
148
-
149
- private
150
-
151
- def build_destination(sqs_queue_url)
152
- {
153
- 'Destination.DeliveryChannel' => 'SQS',
154
- 'Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
155
- 'Destination.AttributeList.member.1.Value' => sqs_queue_url
156
- }
157
- end
158
-
159
- def build_subscription(notification_type, sqs_queue_url, enabled = true)
160
- {
161
- 'Subscription.IsEnabled' => enabled,
162
- 'Subscription.NotificationType' => notification_type,
163
- 'Subscription.Destination.DeliveryChannel' => 'SQS',
164
- 'Subscription.Destination.AttributeList.member.1.Key' => 'sqsQueueUrl',
165
- 'Subscription.Destination.AttributeList.member.1.Value' => sqs_queue_url
166
- }
167
- end
168
- end
169
- end
1
+ require 'mws/subscriptions/client'
data/lib/mws.rb CHANGED
@@ -18,8 +18,8 @@ module MWS
18
18
  extend Forwardable
19
19
 
20
20
  MWS.constants.each do |klass|
21
- method_name = klass.to_s.gsub(/(.)([A-Z])/,'\1_\2').downcase
22
- def_delegator MWS.const_get(klass), :new, method_name
21
+ method_name = klass.to_s.gsub(/(.)([A-Z])/, '\1_\2').downcase
22
+ def_delegator MWS.const_get(klass).const_get(:Client), :new, method_name
23
23
  end
24
24
  end
25
25
  end
@@ -26,7 +26,7 @@ module Peddler
26
26
  attr_writer :merchant_id, :marketplace_id, :parser
27
27
  attr_reader :body
28
28
 
29
- alias :configure :tap
29
+ alias_method :configure, :tap
30
30
 
31
31
  params('SellerId' => -> { merchant_id })
32
32
 
@@ -39,7 +39,7 @@ module Peddler
39
39
  end
40
40
 
41
41
  def initialize(opts = {})
42
- opts.each { |k, v| self.send("#{k}=", v) }
42
+ opts.each { |k, v| send("#{k}=", v) }
43
43
  end
44
44
 
45
45
  def aws_endpoint
@@ -103,7 +103,7 @@ module Peddler
103
103
  end
104
104
 
105
105
  def host
106
- HOSTS.fetch(marketplace_id) { raise BadMarketplaceId }
106
+ HOSTS.fetch(marketplace_id) { fail BadMarketplaceId }
107
107
  end
108
108
 
109
109
  def extract_options(args)
@@ -21,7 +21,7 @@ module Peddler
21
21
  end
22
22
 
23
23
  def records_count
24
- summarize if has_summary?
24
+ summarize if summary?
25
25
  end
26
26
 
27
27
  def valid?
@@ -31,7 +31,7 @@ module Peddler
31
31
  private
32
32
 
33
33
  def extract_content
34
- if has_summary?
34
+ if summary?
35
35
  @summary, @content = body.split("\n\n")
36
36
  else
37
37
  @content = body.dup
@@ -42,7 +42,7 @@ module Peddler
42
42
  content.force_encoding(encoding).encode('UTF-8')
43
43
  end
44
44
 
45
- def has_summary?
45
+ def summary?
46
46
  body.start_with?('Feed Processing Summary')
47
47
  end
48
48
 
@@ -12,7 +12,7 @@ module Peddler
12
12
  def structure!(*list_keys)
13
13
  list_key = list_keys.first
14
14
 
15
- if has_key?(list_key)
15
+ if key?(list_key)
16
16
  builder = StructuredList.new(*list_keys)
17
17
  vals = delete(list_key)
18
18
  update(builder.build(vals))
@@ -24,7 +24,6 @@ module Peddler
24
24
  def store(key, val)
25
25
  key = camelize(key) if key.is_a?(Symbol)
26
26
 
27
-
28
27
  if val.respond_to?(:iso8601)
29
28
  val = val.iso8601
30
29
  elsif val.is_a?(Struct)
@@ -46,7 +45,7 @@ module Peddler
46
45
  self
47
46
  end
48
47
 
49
- alias :add :update
48
+ alias_method :add, :update
50
49
 
51
50
  private
52
51
 
@@ -8,9 +8,7 @@ module Peddler
8
8
  def build(vals)
9
9
  Array(vals)
10
10
  .each_with_index
11
- .reduce(Hash.new) { |hsh, (v, i)|
12
- hsh.merge(compose_key(i + 1) => v)
13
- }
11
+ .reduce(Hash.new) { |hsh, (v, i)| hsh.merge(compose_key(i + 1) => v) }
14
12
  end
15
13
 
16
14
  private
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.8.0'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -23,7 +23,7 @@ module Peddler
23
23
  private
24
24
 
25
25
  def find_result
26
- results = xml.values[0].find { |k, v| k.include?('Result') }
26
+ results = xml.values[0].find { |k, _| k.include?('Result') }
27
27
  results ? results.last : nil
28
28
  end
29
29
  end
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/cart_information'
3
3
 
4
- class CartInformationTest < IntegrationTest
4
+ class TestCartInformation < IntegrationTest
5
5
  def test_gets_service_status
6
6
  clients.each do |client|
7
7
  res = client.get_service_status
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/customer_information'
3
3
 
4
- class CustomerInformationTest < IntegrationTest
4
+ class TestCustomerInformation < IntegrationTest
5
5
  def test_gets_service_status
6
6
  clients.each do |client|
7
7
  res = client.get_service_status
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/feeds'
3
3
 
4
- class FeedsTest < IntegrationTest
4
+ class TestFeeds < IntegrationTest
5
5
  def test_gets_feed_submission_count
6
6
  clients.each do |client|
7
7
  res = client.get_feed_submission_count
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/fulfillment_inbound_shipment'
3
3
 
4
- class FulfillmentInboundShipmentTest < IntegrationTest
4
+ class TestFulfillmentInboundShipment < IntegrationTest
5
5
  def test_gets_service_status
6
6
  clients.each do |client|
7
7
  res = client.get_service_status
@@ -1,14 +1,10 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/fulfillment_inventory'
3
3
 
4
- class FulfillmentInventoryTest < IntegrationTest
5
- def a_month_ago
6
- Date.today - 30
7
- end
8
-
4
+ class TestFulfillmentInventory < IntegrationTest
9
5
  def test_lists_inventory_supply
10
6
  clients.each do |client|
11
- res = client.list_inventory_supply(query_start_date_time: a_month_ago)
7
+ res = client.list_inventory_supply(query_start_date_time: Date.today - 30)
12
8
  refute_empty res.parse
13
9
  end
14
10
  end
@@ -1,58 +1,11 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/fulfillment_outbound_shipment'
3
- require 'excon/errors'
4
-
5
- class FulfillmentOutboundShipmentTest < IntegrationTest
6
- TEST_VER = 4
7
3
 
4
+ class TestFulfillmentOutboundShipment < IntegrationTest
8
5
  def test_gets_service_status
9
6
  clients.each do |client|
10
7
  res = client.get_service_status
11
8
  refute_empty res.parse
12
9
  end
13
10
  end
14
-
15
- def test_create_fulfillment_order
16
- begin
17
- clients.each do |client|
18
- seller_fulfillment_order_id = "frobnitz-#{TEST_VER}"
19
- displayable_order_id = "Schnizzlebits-#{TEST_VER}"
20
- displayable_order_date_time = "2014-04-15T08:18:44+00:00"
21
- displayable_order_comment = "Thanks for your fantastic order"
22
- shipping_speed_category = "Standard"
23
-
24
- address = {
25
- :name => "Snoop Dog",
26
- :line1 => "4339 H Dr.",
27
- :city => "Oakland",
28
- :state_or_province_code => "CA",
29
- :country_code => "US",
30
- :postal_code => "94618"
31
- }
32
-
33
- item = {
34
- 'SellerSKU' => 'PI-ANX1-KMPO',
35
- :seller_fulfillment_order_item_id => "orderfrobnitz-#{TEST_VER}",
36
- :quantity => 1
37
- }
38
-
39
- res = client.create_fulfillment_order(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time,
40
- displayable_order_comment, shipping_speed_category, address, [item])
41
-
42
- # Note: sometimes this test fails because you can't cancel an order immediately after
43
- # creating it. MWS will return an internal server error like "SIRM call failed"
44
- # If this happens, comment out the create_fulfillment_order call and try running the test again
45
- # after a minute or two, and it should pass. Once you have all the VCR cassettes you should be fine
46
- client.cancel_fulfillment_order(seller_fulfillment_order_id)
47
- end
48
-
49
- rescue Excon::Errors::HTTPStatusError => e
50
- if e.response.body.include?('Seller is not registered')
51
- skip('Seller not registered')
52
- else
53
- warn "Failure (status: #{e.response.status}): #{e.response.body}"
54
- raise e
55
- end
56
- end
57
- end
58
11
  end
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/off_amazon_payments'
3
3
 
4
- class OffAmazonPaymentsTest < IntegrationTest
4
+ class TestOffAmazonPayments < IntegrationTest
5
5
  def test_gets_service_status
6
6
  clients.each do |client|
7
7
  res = client.get_service_status
@@ -1,18 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/orders'
3
3
 
4
- class OrdersTest < IntegrationTest
5
- def a_year_ago
6
- Date.today - 365
7
- end
8
-
9
- def test_lists_orders
10
- clients.each do |client|
11
- res = client.list_orders(created_after: a_year_ago)
12
- refute_empty res.parse
13
- end
14
- end
15
-
4
+ class TestOrders < IntegrationTest
16
5
  def test_gets_service_status
17
6
  clients.each do |client|
18
7
  res = client.get_service_status
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/products'
3
3
 
4
- class ProductsTest < IntegrationTest
4
+ class TestProducts < IntegrationTest
5
5
  def test_lists_matching_products
6
6
  clients.each do |client|
7
7
  res = client.list_matching_products('architecture')
@@ -1,16 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/recommendations'
3
3
 
4
- class RecommendationsTest < IntegrationTest
5
- def test_gets_last_updated_time_for_recommendations
6
- clients.each do |client|
7
- res = client.get_last_updated_time_for_recommendations
8
- # MWS won't recommend unless account has actual sales
9
- skip unless content = res.parse
10
- refute_empty content
11
- end
12
- end
13
-
4
+ class TestRecommendations < IntegrationTest
14
5
  def test_lists_recommendations
15
6
  clients.each do |client|
16
7
  res = client.list_recommendations
@@ -1,7 +1,7 @@
1
- require 'integration_helper'
1
+ require 'integration_test_helper'
2
2
  require 'mws/reports'
3
3
 
4
- class ReportsTest < IntegrationTest
4
+ class TestReports < IntegrationTest
5
5
  def test_gets_report_request_count
6
6
  clients.each do |client|
7
7
  res = client.get_report_request_count
@@ -31,7 +31,6 @@ class ReportsTest < IntegrationTest
31
31
  end
32
32
 
33
33
  def test_gets_report_count
34
- skip("Some endpoints don't work")
35
34
  clients.each do |client|
36
35
  res = client.get_report_count
37
36
  refute_empty res.parse