mws-orders 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +16 -25
  4. data/lib/mws-orders.rb +2 -29
  5. data/lib/mws/orders/collection.rb +29 -0
  6. data/lib/mws/orders/document.rb +28 -0
  7. data/lib/mws/orders/entity.rb +39 -0
  8. data/lib/mws/orders/invoice_data.rb +23 -0
  9. data/lib/mws/orders/order.rb +113 -0
  10. data/lib/mws/orders/order_item.rb +108 -0
  11. data/lib/mws/orders/order_items.rb +15 -0
  12. data/lib/mws/orders/orders.rb +15 -0
  13. data/lib/mws/orders/parser.rb +52 -0
  14. data/lib/mws/orders/payment_execution_detail.rb +12 -0
  15. data/lib/mws/orders/payment_execution_detail_item.rb +15 -0
  16. data/lib/mws/orders/service_status.rb +24 -0
  17. data/lib/mws/orders/service_status_message.rb +15 -0
  18. data/lib/mws/orders/shipping_address.rb +35 -0
  19. data/lib/mws/orders/tokenable.rb +10 -0
  20. data/lib/mws/orders/version.rb +1 -1
  21. data/test/integration/test_integration.rb +26 -0
  22. data/test/mws/orders/test_entity.rb +88 -0
  23. data/test/{parsers/order_test.rb → mws/orders/test_order.rb} +11 -6
  24. data/test/{parsers/order_item_test.rb → mws/orders/test_order_item.rb} +4 -4
  25. data/test/mws/orders/test_order_items.rb +19 -0
  26. data/test/mws/orders/test_orders.rb +19 -0
  27. data/test/mws/orders/test_parser.rb +7 -0
  28. data/test/mws/orders/test_payment_execution_detail.rb +15 -0
  29. data/test/mws/orders/test_payment_execution_detail_item.rb +16 -0
  30. data/test/mws/orders/test_service_status.rb +24 -0
  31. data/test/mws/orders/test_service_status_message.rb +16 -0
  32. data/test/{parsers/shipping_address_test.rb → mws/orders/test_shipping_address.rb} +4 -4
  33. data/test/test_helper.rb +15 -6
  34. metadata +67 -134
  35. data/lib/mws/orders/client.rb +0 -88
  36. data/lib/mws/orders/helpers/parameters.rb +0 -53
  37. data/lib/mws/orders/helpers/structured_list.rb +0 -40
  38. data/lib/mws/orders/parsers/base.rb +0 -27
  39. data/lib/mws/orders/parsers/collection.rb +0 -22
  40. data/lib/mws/orders/parsers/invoice_data.rb +0 -23
  41. data/lib/mws/orders/parsers/model.rb +0 -38
  42. data/lib/mws/orders/parsers/order.rb +0 -108
  43. data/lib/mws/orders/parsers/order_item.rb +0 -107
  44. data/lib/mws/orders/parsers/order_items.rb +0 -17
  45. data/lib/mws/orders/parsers/orders.rb +0 -17
  46. data/lib/mws/orders/parsers/payment_execution_detail.rb +0 -17
  47. data/lib/mws/orders/parsers/payment_execution_detail_item.rb +0 -15
  48. data/lib/mws/orders/parsers/service_status.rb +0 -32
  49. data/lib/mws/orders/parsers/service_status_message.rb +0 -15
  50. data/lib/mws/orders/parsers/shipping_address.rb +0 -35
  51. data/lib/mws/orders/requests/base.rb +0 -55
  52. data/lib/mws/orders/requests/order_items.rb +0 -23
  53. data/lib/mws/orders/requests/orders.rb +0 -36
  54. data/lib/mws/orders/requests/service_status.rb +0 -18
  55. data/test/fixtures/mws.yml +0 -12
  56. data/test/helpers/parameters_test.rb +0 -34
  57. data/test/helpers/structured_list_test.rb +0 -17
  58. data/test/integration/order_items_test.rb +0 -16
  59. data/test/integration/orders_test.rb +0 -17
  60. data/test/integration/service_status_test.rb +0 -9
  61. data/test/integration/test_helper.rb +0 -12
  62. data/test/parsers/collection_test.rb +0 -7
  63. data/test/parsers/model_test.rb +0 -27
  64. data/test/parsers/order_items_test.rb +0 -13
  65. data/test/parsers/orders_test.rb +0 -13
  66. data/test/parsers/payment_execution_detail_item_test.rb +0 -16
  67. data/test/parsers/payment_execution_detail_test.rb +0 -13
  68. data/test/parsers/service_status_message_test.rb +0 -16
  69. data/test/parsers/service_status_test.rb +0 -38
  70. data/test/parsers/test_helper.rb +0 -10
  71. data/test/requests/order_items_test.rb +0 -36
  72. data/test/requests/orders_test.rb +0 -46
  73. data/test/requests/service_status_test.rb +0 -22
  74. data/test/requests/test_helper.rb +0 -18
@@ -0,0 +1,16 @@
1
+ require "test_helper"
2
+
3
+ class TestPaymentExecutionDetailItem < MiniTest::Test
4
+ def setup
5
+ node = load_xml_fixture("orders").xpath("//xmlns:PaymentExecutionDetailItem").first
6
+ @pedi = PaymentExecutionDetailItem.new(node)
7
+ end
8
+
9
+ def test_payment
10
+ assert_kind_of Money, @pedi.payment
11
+ end
12
+
13
+ def test_payment_method
14
+ assert_kind_of String, @pedi.payment_method
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ require "test_helper"
2
+
3
+ class TestServiceStatus < MiniTest::Test
4
+ def setup
5
+ node = load_xml_fixture("service_status").xpath("//xmlns:GetServiceStatusResult").first
6
+ @status = ServiceStatus.new(node)
7
+ end
8
+
9
+ def test_status
10
+ assert_kind_of String, @status.status
11
+ end
12
+
13
+ def test_timestamp
14
+ assert_kind_of Time, @status.timestamp
15
+ end
16
+
17
+ def test_message_id
18
+ assert_kind_of String, @status.message_id
19
+ end
20
+
21
+ def test_messages
22
+ assert_kind_of Array, @status.messages
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ require "test_helper"
2
+
3
+ class TestServiceStatusMessage < MiniTest::Test
4
+ def setup
5
+ node = load_xml_fixture("service_status").xpath("//xmlns:Message").first
6
+ @message = ServiceStatusMessage.new(node)
7
+ end
8
+
9
+ def test_locale
10
+ assert_kind_of String, @message.locale
11
+ end
12
+
13
+ def test_text
14
+ assert_kind_of String, @message.text
15
+ end
16
+ end
@@ -1,9 +1,9 @@
1
- require_relative 'test_helper'
1
+ require "test_helper"
2
2
 
3
- class ShippingAddressParserTest < ParserTest
3
+ class TestShippingAddress < MiniTest::Test
4
4
  def setup
5
- node = fixture('orders').xpath('//xmlns:ShippingAddress').first
6
- @address = Parser::ShippingAddress.new(node)
5
+ node = load_xml_fixture("orders").xpath("//xmlns:ShippingAddress").first
6
+ @address = ShippingAddress.new(node)
7
7
  end
8
8
 
9
9
  def test_name
data/test/test_helper.rb CHANGED
@@ -1,7 +1,16 @@
1
- $:.unshift(File.expand_path('../../lib', __FILE__))
2
- require 'mws-orders'
3
- require 'minitest/autorun'
4
- require 'minitest/pride'
5
- require 'pry'
1
+ require "minitest/autorun"
2
+ require "pry"
3
+ require "mws-orders"
6
4
 
7
- include MWS::Orders
5
+ I18n.enforce_available_locales = false
6
+
7
+ class MiniTest::Test
8
+ include MWS::Orders
9
+
10
+ def load_xml_fixture(type)
11
+ file = File.expand_path("../fixtures/#{type}.xml", __FILE__)
12
+ body = File.read(file)
13
+
14
+ Nokogiri(body)
15
+ end
16
+ end
metadata CHANGED
@@ -1,174 +1,117 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mws-orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '6.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.1'
26
+ version: '6.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.6'
33
+ version: '1.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.6'
40
+ version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: peddler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.1
47
+ version: 0.9.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.1
54
+ version: 0.9.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: structure
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.25.1
61
+ version: 0.29.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.25.1
69
- - !ruby/object:Gem::Dependency
70
- name: minitest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
68
+ version: 0.29.0
111
69
  description: A Ruby interface to the Amazon MWS Orders API
112
70
  email:
113
- - code@papercavalier.com
71
+ - me@hakanensari.com
114
72
  executables: []
115
73
  extensions: []
116
74
  extra_rdoc_files: []
117
75
  files:
118
- - lib/mws/orders/client.rb
119
- - lib/mws/orders/helpers/parameters.rb
120
- - lib/mws/orders/helpers/structured_list.rb
121
- - lib/mws/orders/parsers/base.rb
122
- - lib/mws/orders/parsers/collection.rb
123
- - lib/mws/orders/parsers/invoice_data.rb
124
- - lib/mws/orders/parsers/model.rb
125
- - lib/mws/orders/parsers/order.rb
126
- - lib/mws/orders/parsers/order_item.rb
127
- - lib/mws/orders/parsers/order_items.rb
128
- - lib/mws/orders/parsers/orders.rb
129
- - lib/mws/orders/parsers/payment_execution_detail.rb
130
- - lib/mws/orders/parsers/payment_execution_detail_item.rb
131
- - lib/mws/orders/parsers/service_status.rb
132
- - lib/mws/orders/parsers/service_status_message.rb
133
- - lib/mws/orders/parsers/shipping_address.rb
134
- - lib/mws/orders/requests/base.rb
135
- - lib/mws/orders/requests/order_items.rb
136
- - lib/mws/orders/requests/orders.rb
137
- - lib/mws/orders/requests/service_status.rb
138
- - lib/mws/orders/version.rb
139
- - lib/mws-orders.rb
140
76
  - LICENSE
141
77
  - README.md
142
- - test/fixtures/mws.yml
78
+ - lib/mws-orders.rb
79
+ - lib/mws/orders/collection.rb
80
+ - lib/mws/orders/document.rb
81
+ - lib/mws/orders/entity.rb
82
+ - lib/mws/orders/invoice_data.rb
83
+ - lib/mws/orders/order.rb
84
+ - lib/mws/orders/order_item.rb
85
+ - lib/mws/orders/order_items.rb
86
+ - lib/mws/orders/orders.rb
87
+ - lib/mws/orders/parser.rb
88
+ - lib/mws/orders/payment_execution_detail.rb
89
+ - lib/mws/orders/payment_execution_detail_item.rb
90
+ - lib/mws/orders/service_status.rb
91
+ - lib/mws/orders/service_status_message.rb
92
+ - lib/mws/orders/shipping_address.rb
93
+ - lib/mws/orders/tokenable.rb
94
+ - lib/mws/orders/version.rb
143
95
  - test/fixtures/mws.yml.example
144
96
  - test/fixtures/order_items.xml
145
97
  - test/fixtures/orders.xml
146
98
  - test/fixtures/service_status.xml
147
- - test/helpers/parameters_test.rb
148
- - test/helpers/structured_list_test.rb
149
- - test/integration/order_items_test.rb
150
- - test/integration/orders_test.rb
151
- - test/integration/service_status_test.rb
152
- - test/integration/test_helper.rb
153
- - test/parsers/collection_test.rb
154
- - test/parsers/model_test.rb
155
- - test/parsers/order_item_test.rb
156
- - test/parsers/order_items_test.rb
157
- - test/parsers/order_test.rb
158
- - test/parsers/orders_test.rb
159
- - test/parsers/payment_execution_detail_item_test.rb
160
- - test/parsers/payment_execution_detail_test.rb
161
- - test/parsers/service_status_message_test.rb
162
- - test/parsers/service_status_test.rb
163
- - test/parsers/shipping_address_test.rb
164
- - test/parsers/test_helper.rb
165
- - test/requests/order_items_test.rb
166
- - test/requests/orders_test.rb
167
- - test/requests/service_status_test.rb
168
- - test/requests/test_helper.rb
99
+ - test/integration/test_integration.rb
100
+ - test/mws/orders/test_entity.rb
101
+ - test/mws/orders/test_order.rb
102
+ - test/mws/orders/test_order_item.rb
103
+ - test/mws/orders/test_order_items.rb
104
+ - test/mws/orders/test_orders.rb
105
+ - test/mws/orders/test_parser.rb
106
+ - test/mws/orders/test_payment_execution_detail.rb
107
+ - test/mws/orders/test_payment_execution_detail_item.rb
108
+ - test/mws/orders/test_service_status.rb
109
+ - test/mws/orders/test_service_status_message.rb
110
+ - test/mws/orders/test_shipping_address.rb
169
111
  - test/test_helper.rb
170
- homepage: http://github.com/papercavalier/mws-orders
171
- licenses: []
112
+ homepage: http://github.com/hakanensari/mws-orders
113
+ licenses:
114
+ - MIT
172
115
  metadata: {}
173
116
  post_install_message:
174
117
  rdoc_options: []
@@ -176,46 +119,36 @@ require_paths:
176
119
  - lib
177
120
  required_ruby_version: !ruby/object:Gem::Requirement
178
121
  requirements:
179
- - - '>='
122
+ - - ">="
180
123
  - !ruby/object:Gem::Version
181
124
  version: '1.9'
182
125
  required_rubygems_version: !ruby/object:Gem::Requirement
183
126
  requirements:
184
- - - '>='
127
+ - - ">="
185
128
  - !ruby/object:Gem::Version
186
129
  version: '0'
187
130
  requirements: []
188
131
  rubyforge_project:
189
- rubygems_version: 2.0.5
132
+ rubygems_version: 2.3.0
190
133
  signing_key:
191
134
  specification_version: 4
192
135
  summary: Wraps the Amazon MWS Orders API
193
136
  test_files:
194
- - test/fixtures/mws.yml
195
137
  - test/fixtures/mws.yml.example
196
138
  - test/fixtures/order_items.xml
197
139
  - test/fixtures/orders.xml
198
140
  - test/fixtures/service_status.xml
199
- - test/helpers/parameters_test.rb
200
- - test/helpers/structured_list_test.rb
201
- - test/integration/order_items_test.rb
202
- - test/integration/orders_test.rb
203
- - test/integration/service_status_test.rb
204
- - test/integration/test_helper.rb
205
- - test/parsers/collection_test.rb
206
- - test/parsers/model_test.rb
207
- - test/parsers/order_item_test.rb
208
- - test/parsers/order_items_test.rb
209
- - test/parsers/order_test.rb
210
- - test/parsers/orders_test.rb
211
- - test/parsers/payment_execution_detail_item_test.rb
212
- - test/parsers/payment_execution_detail_test.rb
213
- - test/parsers/service_status_message_test.rb
214
- - test/parsers/service_status_test.rb
215
- - test/parsers/shipping_address_test.rb
216
- - test/parsers/test_helper.rb
217
- - test/requests/order_items_test.rb
218
- - test/requests/orders_test.rb
219
- - test/requests/service_status_test.rb
220
- - test/requests/test_helper.rb
141
+ - test/integration/test_integration.rb
142
+ - test/mws/orders/test_entity.rb
143
+ - test/mws/orders/test_order.rb
144
+ - test/mws/orders/test_order_item.rb
145
+ - test/mws/orders/test_order_items.rb
146
+ - test/mws/orders/test_orders.rb
147
+ - test/mws/orders/test_parser.rb
148
+ - test/mws/orders/test_payment_execution_detail.rb
149
+ - test/mws/orders/test_payment_execution_detail_item.rb
150
+ - test/mws/orders/test_service_status.rb
151
+ - test/mws/orders/test_service_status_message.rb
152
+ - test/mws/orders/test_shipping_address.rb
221
153
  - test/test_helper.rb
154
+ has_rdoc:
@@ -1,88 +0,0 @@
1
- module MWS
2
- module Orders
3
- class Client < ::Peddler::Orders
4
- extend Forwardable
5
-
6
- # Public: Get one or more orders.
7
- #
8
- # amazon_order_ids - One or more String Amazon order ids.
9
- #
10
- # Examples
11
- #
12
- # client.get_order('123-1234567-1234567')
13
- #
14
- # Returns an enumerable list of Orders.
15
- def_delegator :orders, :get, :get_order
16
-
17
- # Public: List orders created or updated during a specified time frame.
18
- #
19
- # params - The Hash request parameters used to narrow the orders list.
20
- # Refer to the MWS Orders API for available parameters.
21
- #
22
- # Examples
23
- #
24
- # client.list_orders(created_after: 1.week.ago)
25
- #
26
- # Returns an enumerable list of Orders.
27
- def_delegator :orders, :list, :list_orders
28
-
29
- # Public: List the next page of orders using the NextToken parameter.
30
- #
31
- # Examples
32
- #
33
- # client.list_orders_by_next_token
34
- #
35
- # Returns an enumerable list of Orders.
36
- def_delegator :orders, :list_by_next_token, :list_orders_by_next_token
37
-
38
- # Public: List order items for an amazon order.
39
- #
40
- # amazon_order_id - The String Amazon order id.
41
- #
42
- # Examples
43
- #
44
- # client.list_order_items('123-1234567-1234567')
45
- #
46
- # Returns an enaumerable list of Order Items.
47
- def_delegator :order_items, :list, :list_order_items
48
-
49
- # Public: List the next page of order items using the NextToken
50
- # parameter.
51
- #
52
- # Examples
53
- #
54
- # client.list_order_items_by_next_token
55
- #
56
- # Returns an enaumerable list of Order Items.
57
- def_delegator :order_items, :list_by_next_token, :list_order_items_by_next_token
58
-
59
- # Public: Get the service status of the API.
60
- #
61
- # Examples
62
- #
63
- # client.get_service_status
64
- #
65
- # Returns the Service Status.
66
- def_delegator :service_status, :get, :get_service_status
67
-
68
- # Internal: Returns the String home marketplace id of the client.
69
- def home_marketplace_id
70
- marketplace_id(country)
71
- end
72
-
73
- private
74
-
75
- def orders
76
- @orders ||= Request::Orders.new(self)
77
- end
78
-
79
- def order_items
80
- @order_items ||= Request::OrderItems.new(self)
81
- end
82
-
83
- def service_status
84
- @service_status ||= Request::ServiceStatus.new(self)
85
- end
86
- end
87
- end
88
- end