peddler 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -6
  3. data/lib/peddler/api.rb +28 -13
  4. data/lib/peddler/{api → apis}/amazon_warehousing_and_distribution_2024_05_09.rb +5 -5
  5. data/lib/peddler/{api → apis}/aplus_content_2020_11_01.rb +12 -12
  6. data/lib/peddler/{api → apis}/application_integrations_2024_04_01.rb +5 -5
  7. data/lib/peddler/{api → apis}/application_management_2023_11_30.rb +3 -3
  8. data/lib/peddler/{api → apis}/catalog_items_2020_12_01.rb +4 -4
  9. data/lib/peddler/{api → apis}/catalog_items_2022_04_01.rb +5 -5
  10. data/lib/peddler/{api → apis}/catalog_items_v0.rb +5 -5
  11. data/lib/peddler/{api → apis}/data_kiosk_2023_11_15.rb +7 -7
  12. data/lib/peddler/{api → apis}/easy_ship_2022_03_23.rb +20 -21
  13. data/lib/peddler/{api → apis}/fba_inbound_eligibility_v1.rb +3 -3
  14. data/lib/peddler/{api → apis}/fba_inventory_v1.rb +6 -6
  15. data/lib/peddler/{api → apis}/feeds_2021_06_30.rb +12 -9
  16. data/lib/peddler/{api → apis}/finances_2024_06_19.rb +3 -3
  17. data/lib/peddler/apis/finances_v0.rb +135 -0
  18. data/lib/peddler/{api → apis}/fulfillment_inbound_2024_03_20.rb +84 -54
  19. data/lib/peddler/{api → apis}/fulfillment_inbound_v0.rb +27 -20
  20. data/lib/peddler/{api → apis}/fulfillment_outbound_2020_07_01.rb +16 -16
  21. data/lib/peddler/{api → apis}/invoices_2024_06_19.rb +9 -9
  22. data/lib/peddler/{api → apis}/listings_items_2020_09_01.rb +5 -5
  23. data/lib/peddler/{api → apis}/listings_items_2021_08_01.rb +7 -41
  24. data/lib/peddler/{api → apis}/listings_restrictions_2021_08_01.rb +3 -3
  25. data/lib/peddler/{api → apis}/merchant_fulfillment_v0.rb +14 -14
  26. data/lib/peddler/{api → apis}/messaging_v1.rb +15 -15
  27. data/lib/peddler/{api → apis}/notifications_v1.rb +10 -10
  28. data/lib/peddler/{api → apis}/orders_v0.rb +13 -13
  29. data/lib/peddler/{api → apis}/product_fees_v0.rb +5 -5
  30. data/lib/peddler/{api → apis}/product_pricing_2022_05_01.rb +8 -8
  31. data/lib/peddler/{api → apis}/product_pricing_v0.rb +8 -8
  32. data/lib/peddler/{api → apis}/product_type_definitions_2020_09_01.rb +4 -4
  33. data/lib/peddler/{api → apis}/replenishment_2022_11_07.rb +5 -5
  34. data/lib/peddler/{api → apis}/reports_2021_06_30.rb +12 -12
  35. data/lib/peddler/{api → apis}/sales_v1.rb +3 -3
  36. data/lib/peddler/{api → apis}/sellers_v1.rb +4 -4
  37. data/lib/peddler/{api → apis}/services_v1.rb +19 -19
  38. data/lib/peddler/{api → apis}/shipment_invoicing_v0.rb +5 -5
  39. data/lib/peddler/{api → apis}/shipping_v1.rb +11 -11
  40. data/lib/peddler/{api → apis}/shipping_v2.rb +19 -19
  41. data/lib/peddler/{api → apis}/solicitations_v1.rb +4 -4
  42. data/lib/peddler/{api → apis}/supply_sources_2020_07_01.rb +8 -8
  43. data/lib/peddler/{api → apis}/tokens_2021_03_01.rb +3 -3
  44. data/lib/peddler/{api → apis}/uploads_2020_11_01.rb +3 -3
  45. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_inventory_v1.rb +4 -4
  46. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_2021_12_28.rb +5 -5
  47. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_v1.rb +6 -6
  48. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_payments_v1.rb +4 -4
  49. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +9 -9
  50. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_2021_12_28.rb +17 -17
  51. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_v1.rb +30 -30
  52. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_2021_12_28.rb +4 -4
  53. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_v1.rb +4 -4
  54. data/lib/peddler/{api → apis}/vendor_invoices_v1.rb +4 -4
  55. data/lib/peddler/{api → apis}/vendor_orders_v1.rb +7 -7
  56. data/lib/peddler/{api → apis}/vendor_shipments_v1.rb +6 -6
  57. data/lib/peddler/{api → apis}/vendor_transaction_status_v1.rb +3 -3
  58. data/lib/peddler/endpoint.rb +2 -2
  59. data/lib/peddler/error.rb +21 -12
  60. data/lib/peddler/helpers/feeds_2021_06_30.rb +26 -0
  61. data/lib/peddler/json_feed_document.rb +31 -0
  62. data/lib/peddler/marketplace.rb +46 -2
  63. data/lib/peddler/response.rb +46 -0
  64. data/lib/peddler/version.rb +1 -1
  65. data/lib/peddler.rb +54 -55
  66. metadata +59 -56
  67. data/lib/peddler/api/finances_v0.rb +0 -148
@@ -9,6 +9,7 @@ module Peddler
9
9
  "US" => { id: "ATVPDKIKX0DER", country_name: "United States", selling_region: "North America" },
10
10
  "MX" => { id: "A1AM78C64UM0Y8", country_name: "Mexico", selling_region: "North America" },
11
11
  "BR" => { id: "A2Q3Y263D00KWC", country_name: "Brazil", selling_region: "North America" },
12
+ "IE" => { id: "A28R8C7NBKEWEA", country_name: "Ireland", selling_region: "Europe" },
12
13
  "ES" => { id: "A1RKKUPIHCS9HS", country_name: "Spain", selling_region: "Europe" },
13
14
  "UK" => { id: "A1F83G8C2ARO7P", country_name: "United Kingdom", selling_region: "Europe" },
14
15
  "FR" => { id: "A13V1IB3VIYZZH", country_name: "France", selling_region: "Europe" },
@@ -29,15 +30,52 @@ module Peddler
29
30
  "JP" => { id: "A1VC38T7YXB528", country_name: "Japan", selling_region: "Far East" },
30
31
  }
31
32
 
33
+ # @!parse
34
+ # # Wraps an Amazon marketplace
35
+ # #
36
+ # # @api public
37
+ # #
38
+ # # @!attribute [r] id
39
+ # # @!attribute [r] country_code
40
+ # # @!attribute [r] country_name
41
+ # # @!attribute [r] selling_region
42
+ # class Peddler::Marketplace < Data; end
32
43
  Marketplace = Data.define(:id, :country_code, :country_name, :selling_region) do
33
44
  class << self
45
+ # Finds the marketplace for the given country code
46
+ #
34
47
  # @param [String] country_code
35
48
  def find(country_code)
36
- values = MARKETPLACE_IDS.fetch(country_code) do
49
+ values = MARKETPLACE_IDS.fetch(country_code == "GB" ? "UK" : country_code) do
37
50
  raise ArgumentError, "#{country_code} not found"
38
51
  end
39
52
 
40
- new(**values.merge(country_code: country_code))
53
+ new(**values, country_code: country_code)
54
+ end
55
+
56
+ # Returns the marketplace ID for the given country code
57
+ #
58
+ # @param [String] country_code
59
+ # @return [String]
60
+ def id(country_code)
61
+ find(country_code).id
62
+ end
63
+
64
+ # Returns the marketplace IDs for the given country codes
65
+ #
66
+ # @param [Array<String>] country_codes
67
+ # @return [Array<String>]
68
+ def ids(*country_codes)
69
+ country_codes.map { |country_code| id(country_code) }
70
+ end
71
+
72
+ # Returns all marketplaces
73
+ #
74
+ # @return [Array<Peddler::Marketplace>]
75
+ def all
76
+ MARKETPLACE_IDS.map do |country_code, values|
77
+ new(**values, country_code: country_code)
78
+ end
41
79
  end
42
80
  end
43
81
 
@@ -45,5 +83,11 @@ module Peddler
45
83
  def endpoint
46
84
  Endpoint.find_by_selling_region(selling_region)
47
85
  end
86
+
87
+ # @note So HTTP can encode
88
+ # @return [String]
89
+ def to_str
90
+ id
91
+ end
48
92
  end
49
93
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "delegate"
4
+ require "forwardable"
5
+
6
+ module Peddler
7
+ # Wraps HTTP::Response to allow custom parsing
8
+ class Response < SimpleDelegator
9
+ extend Forwardable
10
+
11
+ # @!method dig(*key)
12
+ # Delegates to the Hash returned by {ResponseDecorator#to_h} to extract a nested
13
+ # value specified by the sequence of keys
14
+ #
15
+ # @param [String] key one or more keys
16
+ # @see https://ruby-doc.org/core/Hash.html#method-i-dig
17
+ def_delegator :to_h, :dig
18
+
19
+ class << self
20
+ # Decorates an HTTP::Response
21
+ #
22
+ # @param [HTTP::Response] response
23
+ # @param [nil, #call] parser (if any)
24
+ # @return [ResponseDecorator]
25
+ def decorate(response, parser: nil)
26
+ new(response).tap do |decorator|
27
+ decorator.parser = parser
28
+ end
29
+ end
30
+ end
31
+
32
+ # @return [#call]
33
+ attr_accessor :parser
34
+
35
+ def parse
36
+ parser ? parser.call(__getobj__) : __getobj__.parse
37
+ end
38
+
39
+ # Converts the response body to a Hash
40
+ #
41
+ # @return [Hash]
42
+ def to_h
43
+ (parser && parser.respond_to?(:to_h) ? parser : parse).to_h
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peddler
4
- VERSION = "3.0.0"
4
+ VERSION = "4.0.0"
5
5
  end
data/lib/peddler.rb CHANGED
@@ -1,58 +1,57 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "peddler/api/amazon_warehousing_and_distribution_2024_05_09"
4
- require "peddler/api/aplus_content_2020_11_01"
5
- require "peddler/api/application_integrations_2024_04_01"
6
- require "peddler/api/application_management_2023_11_30"
7
- require "peddler/api/catalog_items_2020_12_01"
8
- require "peddler/api/catalog_items_2022_04_01"
9
- require "peddler/api/catalog_items_v0"
10
- require "peddler/api/data_kiosk_2023_11_15"
11
- require "peddler/api/easy_ship_2022_03_23"
12
- require "peddler/api/fba_inbound_eligibility_v1"
13
- require "peddler/api/fba_inventory_v1"
14
- require "peddler/api/feeds_2021_06_30"
15
- require "peddler/api/finances_2024_06_19"
16
- require "peddler/api/finances_v0"
17
- require "peddler/api/fulfillment_inbound_2024_03_20"
18
- require "peddler/api/fulfillment_inbound_v0"
19
- require "peddler/api/fulfillment_outbound_2020_07_01"
20
- require "peddler/api/invoices_2024_06_19"
21
- require "peddler/api/listings_items_2020_09_01"
22
- require "peddler/api/listings_items_2021_08_01"
23
- require "peddler/api/listings_restrictions_2021_08_01"
24
- require "peddler/api/merchant_fulfillment_v0"
25
- require "peddler/api/messaging_v1"
26
- require "peddler/api/notifications_v1"
27
- require "peddler/api/orders_v0"
28
- require "peddler/api/product_fees_v0"
29
- require "peddler/api/product_pricing_2022_05_01"
30
- require "peddler/api/product_pricing_v0"
31
- require "peddler/api/product_type_definitions_2020_09_01"
32
- require "peddler/api/replenishment_2022_11_07"
33
- require "peddler/api/reports_2021_06_30"
34
- require "peddler/api/sales_v1"
35
- require "peddler/api/sellers_v1"
36
- require "peddler/api/services_v1"
37
- require "peddler/api/shipment_invoicing_v0"
38
- require "peddler/api/shipping_v1"
39
- require "peddler/api/shipping_v2"
40
- require "peddler/api/solicitations_v1"
41
- require "peddler/api/supply_sources_2020_07_01"
42
- require "peddler/api/tokens_2021_03_01"
43
- require "peddler/api/uploads_2020_11_01"
44
- require "peddler/api/vendor_direct_fulfillment_inventory_v1"
45
- require "peddler/api/vendor_direct_fulfillment_orders_2021_12_28"
46
- require "peddler/api/vendor_direct_fulfillment_orders_v1"
47
- require "peddler/api/vendor_direct_fulfillment_payments_v1"
48
- require "peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28"
49
- require "peddler/api/vendor_direct_fulfillment_shipping_2021_12_28"
50
- require "peddler/api/vendor_direct_fulfillment_shipping_v1"
51
- require "peddler/api/vendor_direct_fulfillment_transactions_2021_12_28"
52
- require "peddler/api/vendor_direct_fulfillment_transactions_v1"
53
- require "peddler/api/vendor_invoices_v1"
54
- require "peddler/api/vendor_orders_v1"
55
- require "peddler/api/vendor_shipments_v1"
56
- require "peddler/api/vendor_transaction_status_v1"
57
- require "peddler/marketplace"
3
+ require "peddler/apis/amazon_warehousing_and_distribution_2024_05_09"
4
+ require "peddler/apis/aplus_content_2020_11_01"
5
+ require "peddler/apis/application_integrations_2024_04_01"
6
+ require "peddler/apis/application_management_2023_11_30"
7
+ require "peddler/apis/catalog_items_2020_12_01"
8
+ require "peddler/apis/catalog_items_2022_04_01"
9
+ require "peddler/apis/catalog_items_v0"
10
+ require "peddler/apis/data_kiosk_2023_11_15"
11
+ require "peddler/apis/easy_ship_2022_03_23"
12
+ require "peddler/apis/fba_inbound_eligibility_v1"
13
+ require "peddler/apis/fba_inventory_v1"
14
+ require "peddler/apis/feeds_2021_06_30"
15
+ require "peddler/apis/finances_2024_06_19"
16
+ require "peddler/apis/finances_v0"
17
+ require "peddler/apis/fulfillment_inbound_2024_03_20"
18
+ require "peddler/apis/fulfillment_inbound_v0"
19
+ require "peddler/apis/fulfillment_outbound_2020_07_01"
20
+ require "peddler/apis/invoices_2024_06_19"
21
+ require "peddler/apis/listings_items_2020_09_01"
22
+ require "peddler/apis/listings_items_2021_08_01"
23
+ require "peddler/apis/listings_restrictions_2021_08_01"
24
+ require "peddler/apis/merchant_fulfillment_v0"
25
+ require "peddler/apis/messaging_v1"
26
+ require "peddler/apis/notifications_v1"
27
+ require "peddler/apis/orders_v0"
28
+ require "peddler/apis/product_fees_v0"
29
+ require "peddler/apis/product_pricing_2022_05_01"
30
+ require "peddler/apis/product_pricing_v0"
31
+ require "peddler/apis/product_type_definitions_2020_09_01"
32
+ require "peddler/apis/replenishment_2022_11_07"
33
+ require "peddler/apis/reports_2021_06_30"
34
+ require "peddler/apis/sales_v1"
35
+ require "peddler/apis/sellers_v1"
36
+ require "peddler/apis/services_v1"
37
+ require "peddler/apis/shipment_invoicing_v0"
38
+ require "peddler/apis/shipping_v1"
39
+ require "peddler/apis/shipping_v2"
40
+ require "peddler/apis/solicitations_v1"
41
+ require "peddler/apis/supply_sources_2020_07_01"
42
+ require "peddler/apis/tokens_2021_03_01"
43
+ require "peddler/apis/uploads_2020_11_01"
44
+ require "peddler/apis/vendor_direct_fulfillment_inventory_v1"
45
+ require "peddler/apis/vendor_direct_fulfillment_orders_2021_12_28"
46
+ require "peddler/apis/vendor_direct_fulfillment_orders_v1"
47
+ require "peddler/apis/vendor_direct_fulfillment_payments_v1"
48
+ require "peddler/apis/vendor_direct_fulfillment_sandbox_test_data_2021_10_28"
49
+ require "peddler/apis/vendor_direct_fulfillment_shipping_2021_12_28"
50
+ require "peddler/apis/vendor_direct_fulfillment_shipping_v1"
51
+ require "peddler/apis/vendor_direct_fulfillment_transactions_2021_12_28"
52
+ require "peddler/apis/vendor_direct_fulfillment_transactions_v1"
53
+ require "peddler/apis/vendor_invoices_v1"
54
+ require "peddler/apis/vendor_orders_v1"
55
+ require "peddler/apis/vendor_shipments_v1"
56
+ require "peddler/apis/vendor_transaction_status_v1"
58
57
  require "peddler/token"
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: 3.0.0
4
+ version: 4.0.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: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -41,63 +41,66 @@ files:
41
41
  - README.md
42
42
  - lib/peddler.rb
43
43
  - lib/peddler/api.rb
44
- - lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb
45
- - lib/peddler/api/aplus_content_2020_11_01.rb
46
- - lib/peddler/api/application_integrations_2024_04_01.rb
47
- - lib/peddler/api/application_management_2023_11_30.rb
48
- - lib/peddler/api/catalog_items_2020_12_01.rb
49
- - lib/peddler/api/catalog_items_2022_04_01.rb
50
- - lib/peddler/api/catalog_items_v0.rb
51
- - lib/peddler/api/data_kiosk_2023_11_15.rb
52
- - lib/peddler/api/easy_ship_2022_03_23.rb
53
- - lib/peddler/api/fba_inbound_eligibility_v1.rb
54
- - lib/peddler/api/fba_inventory_v1.rb
55
- - lib/peddler/api/feeds_2021_06_30.rb
56
- - lib/peddler/api/finances_2024_06_19.rb
57
- - lib/peddler/api/finances_v0.rb
58
- - lib/peddler/api/fulfillment_inbound_2024_03_20.rb
59
- - lib/peddler/api/fulfillment_inbound_v0.rb
60
- - lib/peddler/api/fulfillment_outbound_2020_07_01.rb
61
- - lib/peddler/api/invoices_2024_06_19.rb
62
- - lib/peddler/api/listings_items_2020_09_01.rb
63
- - lib/peddler/api/listings_items_2021_08_01.rb
64
- - lib/peddler/api/listings_restrictions_2021_08_01.rb
65
- - lib/peddler/api/merchant_fulfillment_v0.rb
66
- - lib/peddler/api/messaging_v1.rb
67
- - lib/peddler/api/notifications_v1.rb
68
- - lib/peddler/api/orders_v0.rb
69
- - lib/peddler/api/product_fees_v0.rb
70
- - lib/peddler/api/product_pricing_2022_05_01.rb
71
- - lib/peddler/api/product_pricing_v0.rb
72
- - lib/peddler/api/product_type_definitions_2020_09_01.rb
73
- - lib/peddler/api/replenishment_2022_11_07.rb
74
- - lib/peddler/api/reports_2021_06_30.rb
75
- - lib/peddler/api/sales_v1.rb
76
- - lib/peddler/api/sellers_v1.rb
77
- - lib/peddler/api/services_v1.rb
78
- - lib/peddler/api/shipment_invoicing_v0.rb
79
- - lib/peddler/api/shipping_v1.rb
80
- - lib/peddler/api/shipping_v2.rb
81
- - lib/peddler/api/solicitations_v1.rb
82
- - lib/peddler/api/supply_sources_2020_07_01.rb
83
- - lib/peddler/api/tokens_2021_03_01.rb
84
- - lib/peddler/api/uploads_2020_11_01.rb
85
- - lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb
86
- - lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb
87
- - lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb
88
- - lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb
89
- - lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb
90
- - lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb
91
- - lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb
92
- - lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb
93
- - lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb
94
- - lib/peddler/api/vendor_invoices_v1.rb
95
- - lib/peddler/api/vendor_orders_v1.rb
96
- - lib/peddler/api/vendor_shipments_v1.rb
97
- - lib/peddler/api/vendor_transaction_status_v1.rb
44
+ - lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb
45
+ - lib/peddler/apis/aplus_content_2020_11_01.rb
46
+ - lib/peddler/apis/application_integrations_2024_04_01.rb
47
+ - lib/peddler/apis/application_management_2023_11_30.rb
48
+ - lib/peddler/apis/catalog_items_2020_12_01.rb
49
+ - lib/peddler/apis/catalog_items_2022_04_01.rb
50
+ - lib/peddler/apis/catalog_items_v0.rb
51
+ - lib/peddler/apis/data_kiosk_2023_11_15.rb
52
+ - lib/peddler/apis/easy_ship_2022_03_23.rb
53
+ - lib/peddler/apis/fba_inbound_eligibility_v1.rb
54
+ - lib/peddler/apis/fba_inventory_v1.rb
55
+ - lib/peddler/apis/feeds_2021_06_30.rb
56
+ - lib/peddler/apis/finances_2024_06_19.rb
57
+ - lib/peddler/apis/finances_v0.rb
58
+ - lib/peddler/apis/fulfillment_inbound_2024_03_20.rb
59
+ - lib/peddler/apis/fulfillment_inbound_v0.rb
60
+ - lib/peddler/apis/fulfillment_outbound_2020_07_01.rb
61
+ - lib/peddler/apis/invoices_2024_06_19.rb
62
+ - lib/peddler/apis/listings_items_2020_09_01.rb
63
+ - lib/peddler/apis/listings_items_2021_08_01.rb
64
+ - lib/peddler/apis/listings_restrictions_2021_08_01.rb
65
+ - lib/peddler/apis/merchant_fulfillment_v0.rb
66
+ - lib/peddler/apis/messaging_v1.rb
67
+ - lib/peddler/apis/notifications_v1.rb
68
+ - lib/peddler/apis/orders_v0.rb
69
+ - lib/peddler/apis/product_fees_v0.rb
70
+ - lib/peddler/apis/product_pricing_2022_05_01.rb
71
+ - lib/peddler/apis/product_pricing_v0.rb
72
+ - lib/peddler/apis/product_type_definitions_2020_09_01.rb
73
+ - lib/peddler/apis/replenishment_2022_11_07.rb
74
+ - lib/peddler/apis/reports_2021_06_30.rb
75
+ - lib/peddler/apis/sales_v1.rb
76
+ - lib/peddler/apis/sellers_v1.rb
77
+ - lib/peddler/apis/services_v1.rb
78
+ - lib/peddler/apis/shipment_invoicing_v0.rb
79
+ - lib/peddler/apis/shipping_v1.rb
80
+ - lib/peddler/apis/shipping_v2.rb
81
+ - lib/peddler/apis/solicitations_v1.rb
82
+ - lib/peddler/apis/supply_sources_2020_07_01.rb
83
+ - lib/peddler/apis/tokens_2021_03_01.rb
84
+ - lib/peddler/apis/uploads_2020_11_01.rb
85
+ - lib/peddler/apis/vendor_direct_fulfillment_inventory_v1.rb
86
+ - lib/peddler/apis/vendor_direct_fulfillment_orders_2021_12_28.rb
87
+ - lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb
88
+ - lib/peddler/apis/vendor_direct_fulfillment_payments_v1.rb
89
+ - lib/peddler/apis/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb
90
+ - lib/peddler/apis/vendor_direct_fulfillment_shipping_2021_12_28.rb
91
+ - lib/peddler/apis/vendor_direct_fulfillment_shipping_v1.rb
92
+ - lib/peddler/apis/vendor_direct_fulfillment_transactions_2021_12_28.rb
93
+ - lib/peddler/apis/vendor_direct_fulfillment_transactions_v1.rb
94
+ - lib/peddler/apis/vendor_invoices_v1.rb
95
+ - lib/peddler/apis/vendor_orders_v1.rb
96
+ - lib/peddler/apis/vendor_shipments_v1.rb
97
+ - lib/peddler/apis/vendor_transaction_status_v1.rb
98
98
  - lib/peddler/endpoint.rb
99
99
  - lib/peddler/error.rb
100
+ - lib/peddler/helpers/feeds_2021_06_30.rb
101
+ - lib/peddler/json_feed_document.rb
100
102
  - lib/peddler/marketplace.rb
103
+ - lib/peddler/response.rb
101
104
  - lib/peddler/token.rb
102
105
  - lib/peddler/version.rb
103
106
  homepage: https://github.com/lineofflight/peddler
@@ -1,148 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "peddler/api"
4
-
5
- module Peddler
6
- class << self
7
- def finances_v0(...)
8
- API::FinancesV0.new(...)
9
- end
10
- end
11
-
12
- class API
13
- # Selling Partner API for Finances
14
- #
15
- # The Selling Partner API for Finances provides financial information that is relevant to a seller's business. You
16
- # can obtain financial events for a given order, financial event group, or date range without having to wait until a
17
- # statement period closes. You can also obtain financial event groups for a given date range.
18
- class FinancesV0 < API
19
- # Returns financial event groups for a given date range. Orders from the last 48 hours might not be included in
20
- # financial events.
21
- #
22
- # @note This operation can make a static sandbox call.
23
- # @param max_results_per_page [Integer] The maximum number of results per page. If the response exceeds the
24
- # maximum number of transactions or 10 MB, the response is `InvalidInput`.
25
- # @param financial_event_group_started_before [String] A date that selects financial event groups that opened
26
- # before (but not at) a specified date and time, in [ISO
27
- # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. The date-time must be after
28
- # `FinancialEventGroupStartedAfter` and more than two minutes before the time of request. If
29
- # `FinancialEventGroupStartedAfter` and `FinancialEventGroupStartedBefore` are more than 180 days apart, no
30
- # financial event groups are returned.
31
- # @param financial_event_group_started_after [String] A date that selects financial event groups that opened after
32
- # (or at) a specified date and time, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
33
- # format. The date-time must be more than two minutes before you submit the request.
34
- # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
35
- # `pageSize` value. To get the next page of results, call the operation with this token and include the same
36
- # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
37
- # is null. Note that this operation can return empty pages.
38
- # @param rate_limit [Float] Requests per second
39
- # @return [Hash] The API response
40
- def list_financial_event_groups(max_results_per_page: 10, financial_event_group_started_before: nil,
41
- financial_event_group_started_after: nil, next_token: nil, rate_limit: 0.5)
42
- path = "/finances/v0/financialEventGroups"
43
- params = {
44
- "MaxResultsPerPage" => max_results_per_page,
45
- "FinancialEventGroupStartedBefore" => financial_event_group_started_before,
46
- "FinancialEventGroupStartedAfter" => financial_event_group_started_after,
47
- "NextToken" => next_token,
48
- }.compact
49
-
50
- meter(rate_limit).get(path, params:)
51
- end
52
-
53
- # Returns all financial events for the specified financial event group. Orders from the last 48 hours might not be
54
- # included in financial events. **Note:** This operation only retrieves a group's data for the past two years. A
55
- # request for data spanning more than two years produces an empty response.
56
- #
57
- # @note This operation can make a static sandbox call.
58
- # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
59
- # the maximum number of transactions or 10 MB, the response is `InvalidInput`.
60
- # @param posted_after [String] The response includes financial events posted after (or on) this date. This date
61
- # must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
62
- # must be more than two minutes before the time of the request.
63
- # @param posted_before [String] The response includes financial events posted before (but not on) this date. This
64
- # date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
65
- # date-time must be later than `PostedAfter` and more than two minutes before the requestd was submitted. If
66
- # `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. If you include the
67
- # `PostedBefore` parameter in your request, you must also specify the `PostedAfter` parameter. **Default:** Two
68
- # minutes before the time of the request.
69
- # @param event_group_id [String] The identifier of the financial event group to which the events belong.
70
- # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
71
- # `pageSize` value. To get the next page of results, call the operation with this token and include the same
72
- # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
73
- # is null. Note that this operation can return empty pages.
74
- # @param rate_limit [Float] Requests per second
75
- # @return [Hash] The API response
76
- def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil,
77
- posted_before: nil, next_token: nil, rate_limit: 0.5)
78
- path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
79
- params = {
80
- "MaxResultsPerPage" => max_results_per_page,
81
- "PostedAfter" => posted_after,
82
- "PostedBefore" => posted_before,
83
- "NextToken" => next_token,
84
- }.compact
85
-
86
- meter(rate_limit).get(path, params:)
87
- end
88
-
89
- # Returns all financial events for the specified order. Orders from the last 48 hours might not be included in
90
- # financial events.
91
- #
92
- # @note This operation can make a static sandbox call.
93
- # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
94
- # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
95
- # the maximum number of transactions or 10 MB, the response is `InvalidInput`.
96
- # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
97
- # `pageSize` value. To get the next page of results, call the operation with this token and include the same
98
- # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
99
- # is null. Note that this operation can return empty pages.
100
- # @param rate_limit [Float] Requests per second
101
- # @return [Hash] The API response
102
- def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5)
103
- path = "/finances/v0/orders/#{order_id}/financialEvents"
104
- params = {
105
- "MaxResultsPerPage" => max_results_per_page,
106
- "NextToken" => next_token,
107
- }.compact
108
-
109
- meter(rate_limit).get(path, params:)
110
- end
111
-
112
- # Returns financial events for the specified data range. Orders from the last 48 hours might not be included in
113
- # financial events. **Note:** in `ListFinancialEvents`, deferred events don't show up in responses until in they
114
- # are released.
115
- #
116
- # @note This operation can make a static sandbox call.
117
- # @param max_results_per_page [Integer] The maximum number of results to return per page. If the response exceeds
118
- # the maximum number of transactions or 10 MB, the response is `InvalidInput`.
119
- # @param posted_after [String] The response includes financial events posted after (or on) this date. This date
120
- # must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time
121
- # must be more than two minutes before the time of the request.
122
- # @param posted_before [String] The response includes financial events posted before (but not on) this date. This
123
- # date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The
124
- # date-time must be later than `PostedAfter` and more than two minutes before the request was submitted. If
125
- # `PostedAfter` and `PostedBefore` are more than 180 days apart, the response is empty. If you include the
126
- # `PostedBefore` parameter in your request, you must also specify the `PostedAfter` parameter. **Default:** Two
127
- # minutes before the time of the request.
128
- # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
129
- # `pageSize` value. To get the next page of results, call the operation with this token and include the same
130
- # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
131
- # is null. Note that this operation can return empty pages.
132
- # @param rate_limit [Float] Requests per second
133
- # @return [Hash] The API response
134
- def list_financial_events(max_results_per_page: 100, posted_after: nil, posted_before: nil, next_token: nil,
135
- rate_limit: 0.5)
136
- path = "/finances/v0/financialEvents"
137
- params = {
138
- "MaxResultsPerPage" => max_results_per_page,
139
- "PostedAfter" => posted_after,
140
- "PostedBefore" => posted_before,
141
- "NextToken" => next_token,
142
- }.compact
143
-
144
- meter(rate_limit).get(path, params:)
145
- end
146
- end
147
- end
148
- end