peddler 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0e5aee939a58900e1dd2df7503479738c460f40
4
- data.tar.gz: 33b921b8369e8e01f5b15a6fbdf53c1879f6b9b8
3
+ metadata.gz: 8aba3ba6779ddc13b153cdf037d554c9182e2774
4
+ data.tar.gz: e1ef25617931f33f9d513d1037d08d52a9d133cc
5
5
  SHA512:
6
- metadata.gz: 6f5365a77cfd8bf62d3d8b472f86b710e427c53747aff95f527b7259ab898784f2008edfddc64b847cea84327102a5631ee1251349d341e778a1267871315520
7
- data.tar.gz: 2d3bbd21f89b76e6f33d4a79fe1f23bc99883e1035301a876fad10655ac947c5a15345978d0ac2eb18632b3e99358b2271bf07d7df0a83142199f9dedb06fb5c
6
+ metadata.gz: bb5ca70216b377fc6d7e9718dae7aa10481b7c6d8a6409faa6850e4689e8b4ccd80de68a9d99457a5583ed4536af1a71b273d9618b4d3580804452f2682dd0fd
7
+ data.tar.gz: c8dd299bbc171cdd9a56dd78f4ea3e91e70d98367fb4646c901dc917f45466aae55a1b9d6e7dcd40696f29b2bb39a9522befc58c3115024205989a1082fcb7bd
data/README.md CHANGED
@@ -119,6 +119,12 @@ The MWS Feeds API lets you upload inventory and order data to Amazon. You can al
119
119
 
120
120
  [Read more](http://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
121
121
 
122
+ ### Finances
123
+
124
+ The MWS Finances API enables you to obtain financial information relevant to your business with Amazon. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
125
+
126
+ [Read more](http://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
127
+
122
128
  ### Fulfillment Inbound Shipment
123
129
 
124
130
  With the MWS Fulfillment Inbound Shipment API, you can create and update inbound shipments of inventory in the Amazon Fulfillment Network. You can also also request lists of inbound shipments or inbound shipment items based on criteria that you specify.
@@ -0,0 +1,76 @@
1
+ require 'peddler/client'
2
+
3
+ module MWS
4
+ module Finances
5
+ # With the MWS Finances API you can retrieve financial transactions for your seller account.
6
+ class Client < ::Peddler::Client
7
+ version "2015-05-01"
8
+ path "/Finances/#{version}"
9
+
10
+ # Lists financial events
11
+ #
12
+ # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEvents.html
13
+ # @param opts [Hash]
14
+ # @option opts [Integer] :max_results_per_page
15
+ # @option opts [String] :amazon_order_id
16
+ # @option opts [String] :financial_event_group_id
17
+ # @option opts [String, #iso8601] :posted_after
18
+ # @option opts [String, #iso8601] :posted_before
19
+ # @return [Peddler::XMLParser]
20
+ def list_financial_events(opts = {})
21
+ operation('ListFinancialEvents').add(opts)
22
+ run
23
+ end
24
+
25
+ # Lists the next page of financial events
26
+ #
27
+ # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroupsByNextToken.html
28
+ # @param next_token [String]
29
+ # @return [Peddler::XMLParser]
30
+ def list_financial_events_by_next_token(next_token)
31
+ operation('ListFinancialEventsByNextToken')
32
+ .add('NextToken' => next_token)
33
+
34
+ run
35
+ end
36
+
37
+ # Lists financial event groups
38
+ #
39
+ # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroups.html
40
+ # @param financial_event_group_started_after [String, #iso8601]
41
+ # @param opts [Hash]
42
+ # @option opts [Integer] :max_results_per_page
43
+ # @option opts [String, #iso8601] :financial_event_group_started_before
44
+ # @return [Peddler::XMLParser]
45
+ def list_financial_event_groups(financial_event_group_started_after, opts = {})
46
+ operation('ListFinancialEventGroups')
47
+ .add('FinancialEventGroupStartedAfter' => financial_event_group_started_after)
48
+ .add(opts)
49
+
50
+ run
51
+ end
52
+
53
+ # Lists the next page of financial event groups
54
+ #
55
+ # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroupsByNextToken.html
56
+ # @param next_token [String]
57
+ # @return [Peddler::XMLParser]
58
+ def list_financial_event_groups_by_next_token(next_token)
59
+ operation('ListFinancialEventGroupsByNextToken')
60
+ .add('NextToken' => next_token)
61
+
62
+ run
63
+ end
64
+
65
+ # Gets API status
66
+ #
67
+ # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_GetServiceStatus.html
68
+ # @return [Peddler::XMLParser]
69
+ def get_service_status
70
+ operation('GetServiceStatus')
71
+
72
+ run
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1 @@
1
+ require 'mws/finances/client'
@@ -35,6 +35,7 @@ module MWS
35
35
  operation('ListOrders')
36
36
  .add(opts)
37
37
  .structure!('OrderStatus', 'Status')
38
+ .structure!('FulfillmentChannel', 'Channel')
38
39
  .structure!('MarketplaceId', 'Id')
39
40
  .structure!('PaymentMethod')
40
41
  .structure!('TFMShipmentStatus', 'Status')
data/lib/mws.rb CHANGED
@@ -2,6 +2,7 @@ require 'forwardable'
2
2
  require 'mws/cart_information'
3
3
  require 'mws/customer_information'
4
4
  require 'mws/feeds'
5
+ require 'mws/finances'
5
6
  require 'mws/fulfillment_inbound_shipment'
6
7
  require 'mws/fulfillment_inventory'
7
8
  require 'mws/fulfillment_outbound_shipment'
@@ -73,7 +73,7 @@ module Peddler
73
73
  end
74
74
  end
75
75
 
76
- @error_handler = -> (e) { fail e }
76
+ @error_handler = ->(e) { fail e }
77
77
 
78
78
  # Creates a new client instance
79
79
  #
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.18.0'
2
+ VERSION = '0.19.0'
3
3
  end
@@ -0,0 +1,72 @@
1
+ require 'helper'
2
+ require 'mws/finances/client'
3
+
4
+ class TestMWSFinancesClient < MiniTest::Test
5
+ def setup
6
+ @client = MWS::Finances::Client.new
7
+ end
8
+
9
+ def test_lists_financial_event_groups
10
+ operation = {
11
+ 'Action' => 'ListFinancialEventGroups',
12
+ 'FinancialEventGroupStartedAfter' => '2015-01-01'
13
+ }
14
+
15
+ @client.stub(:run, nil) do
16
+ @client.list_financial_event_groups('2015-01-01')
17
+ end
18
+
19
+ assert_equal operation, @client.operation
20
+ end
21
+
22
+ def test_lists_financial_event_groups_by_next_token
23
+ operation = {
24
+ 'Action' => 'ListFinancialEventGroupsByNextToken',
25
+ 'NextToken' => '1'
26
+ }
27
+
28
+ @client.stub(:run, nil) do
29
+ @client.list_financial_event_groups_by_next_token('1')
30
+ end
31
+
32
+ assert_equal operation, @client.operation
33
+ end
34
+
35
+ def test_lists_financial_events
36
+ operation = {
37
+ 'Action' => 'ListFinancialEvents',
38
+ 'AmazonOrderId' => '123'
39
+ }
40
+
41
+ @client.stub(:run, nil) do
42
+ @client.list_financial_events(amazon_order_id: '123')
43
+ end
44
+
45
+ assert_equal operation, @client.operation
46
+ end
47
+
48
+ def test_lists_financial_events_by_next_token
49
+ operation = {
50
+ 'Action' => 'ListFinancialEventsByNextToken',
51
+ 'NextToken' => '1'
52
+ }
53
+
54
+ @client.stub(:run, nil) do
55
+ @client.list_financial_events_by_next_token('1')
56
+ end
57
+
58
+ assert_equal operation, @client.operation
59
+ end
60
+
61
+ def test_gets_service_status
62
+ operation = {
63
+ 'Action' => 'GetServiceStatus'
64
+ }
65
+
66
+ @client.stub(:run, nil) do
67
+ @client.get_service_status
68
+ end
69
+
70
+ assert_equal operation, @client.operation
71
+ end
72
+ end
@@ -12,7 +12,8 @@ class TestMWSOrdersClient < MiniTest::Test
12
12
  'OrderStatus.Status.1' => '1',
13
13
  'MarketplaceId.Id.1' => '1',
14
14
  'PaymentMethod.1' => '1',
15
- 'TFMShipmentStatus.Status.1' => '1'
15
+ 'TFMShipmentStatus.Status.1' => '1',
16
+ 'FulfillmentChannel.Channel.1' => 'MFN'
16
17
  }
17
18
 
18
19
  @client.stub(:run, nil) do
@@ -20,7 +21,8 @@ class TestMWSOrdersClient < MiniTest::Test
20
21
  marketplace_id: '1',
21
22
  order_status: '1',
22
23
  tfm_shipment_status: '1',
23
- payment_method: '1'
24
+ payment_method: '1',
25
+ fulfillment_channel: 'MFN'
24
26
  )
25
27
  end
26
28
 
@@ -222,7 +222,7 @@ class TestPeddlerClient < MiniTest::Test
222
222
  def test_deprecated_marketplace_id_accessor
223
223
  refute_nil @client.marketplace_id
224
224
  @client.marketplace_id = "123"
225
- assert_equal "123", @client.marketplace_id
226
- assert_equal @client.primary_marketplace_id, @client.marketplace_id
225
+ assert_equal "123", @client.marketplace_id
226
+ assert_equal @client.primary_marketplace_id, @client.marketplace_id
227
227
  end
228
228
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.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: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeff
@@ -54,6 +54,8 @@ files:
54
54
  - lib/mws/customer_information/client.rb
55
55
  - lib/mws/feeds.rb
56
56
  - lib/mws/feeds/client.rb
57
+ - lib/mws/finances.rb
58
+ - lib/mws/finances/client.rb
57
59
  - lib/mws/fulfillment_inbound_shipment.rb
58
60
  - lib/mws/fulfillment_inbound_shipment/client.rb
59
61
  - lib/mws/fulfillment_inventory.rb
@@ -106,6 +108,7 @@ files:
106
108
  - test/unit/mws/test_cart_information_client.rb
107
109
  - test/unit/mws/test_customer_information_client.rb
108
110
  - test/unit/mws/test_feeds_client.rb
111
+ - test/unit/mws/test_finances_client.rb
109
112
  - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
110
113
  - test/unit/mws/test_fulfillment_inventory_client.rb
111
114
  - test/unit/mws/test_fulfillment_outbound_shipment_client.rb
@@ -185,6 +188,7 @@ test_files:
185
188
  - test/unit/mws/test_cart_information_client.rb
186
189
  - test/unit/mws/test_customer_information_client.rb
187
190
  - test/unit/mws/test_feeds_client.rb
191
+ - test/unit/mws/test_finances_client.rb
188
192
  - test/unit/mws/test_fulfillment_inbound_shipment_client.rb
189
193
  - test/unit/mws/test_fulfillment_inventory_client.rb
190
194
  - test/unit/mws/test_fulfillment_outbound_shipment_client.rb