peddler 2.4.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +402 -140
  3. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +92 -0
  4. data/lib/peddler/api/aplus_content_2020_11_01.rb +246 -0
  5. data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +35 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +81 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +93 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +103 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +108 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +127 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +44 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +122 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +122 -0
  15. data/lib/peddler/api/finances_2024_06_19.rb +50 -0
  16. data/lib/peddler/api/finances_v0.rb +148 -0
  17. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +759 -0
  18. data/lib/peddler/api/fulfillment_inbound_v0.rb +352 -0
  19. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +259 -0
  20. data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
  21. data/lib/peddler/api/listings_items_2020_09_01.rb +95 -0
  22. data/lib/peddler/api/listings_items_2021_08_01.rb +170 -0
  23. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +47 -0
  24. data/lib/peddler/api/merchant_fulfillment_v0.rb +80 -0
  25. data/lib/peddler/api/messaging_v1.rb +273 -0
  26. data/lib/peddler/api/notifications_v1.rb +145 -0
  27. data/lib/peddler/api/orders_v0.rb +279 -0
  28. data/lib/peddler/api/product_fees_v0.rb +77 -0
  29. data/lib/peddler/api/product_pricing_2022_05_01.rb +54 -0
  30. data/lib/peddler/api/product_pricing_v0.rb +162 -0
  31. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +86 -0
  32. data/lib/peddler/api/replenishment_2022_11_07.rb +57 -0
  33. data/lib/peddler/api/reports_2021_06_30.rb +163 -0
  34. data/lib/peddler/api/sales_v1.rb +77 -0
  35. data/lib/peddler/api/sellers_v1.rb +45 -0
  36. data/lib/peddler/api/services_v1.rb +348 -0
  37. data/lib/peddler/api/shipment_invoicing_v0.rb +59 -0
  38. data/lib/peddler/api/shipping_v1.rb +132 -0
  39. data/lib/peddler/api/shipping_v2.rb +319 -0
  40. data/lib/peddler/api/solicitations_v1.rb +63 -0
  41. data/lib/peddler/api/supply_sources_2020_07_01.rb +100 -0
  42. data/lib/peddler/api/tokens_2021_03_01.rb +38 -0
  43. data/lib/peddler/api/uploads_2020_11_01.rb +50 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +32 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +84 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +84 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +31 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +203 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  51. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +32 -0
  52. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +32 -0
  53. data/lib/peddler/api/vendor_invoices_v1.rb +30 -0
  54. data/lib/peddler/api/vendor_orders_v1.rb +159 -0
  55. data/lib/peddler/api/vendor_shipments_v1.rb +132 -0
  56. data/lib/peddler/api/vendor_transaction_status_v1.rb +33 -0
  57. data/lib/peddler/api.rb +138 -0
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +31 -0
  60. data/lib/peddler/marketplace.rb +38 -68
  61. data/lib/peddler/token.rb +70 -0
  62. data/lib/peddler/version.rb +1 -1
  63. data/lib/peddler.rb +56 -1
  64. metadata +74 -80
  65. data/lib/mws/easy_ship/client.rb +0 -93
  66. data/lib/mws/easy_ship.rb +0 -3
  67. data/lib/mws/feeds/client.rb +0 -122
  68. data/lib/mws/feeds.rb +0 -3
  69. data/lib/mws/finances/client.rb +0 -82
  70. data/lib/mws/finances.rb +0 -3
  71. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  72. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  73. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  74. data/lib/mws/fulfillment_inventory.rb +0 -3
  75. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  76. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  77. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  78. data/lib/mws/merchant_fulfillment.rb +0 -3
  79. data/lib/mws/off_amazon_payments.rb +0 -3
  80. data/lib/mws/orders/client.rb +0 -120
  81. data/lib/mws/orders.rb +0 -3
  82. data/lib/mws/products/client.rb +0 -268
  83. data/lib/mws/products.rb +0 -3
  84. data/lib/mws/recommendations/client.rb +0 -72
  85. data/lib/mws/recommendations.rb +0 -3
  86. data/lib/mws/reports/client.rb +0 -236
  87. data/lib/mws/reports.rb +0 -3
  88. data/lib/mws/sellers/client.rb +0 -44
  89. data/lib/mws/sellers.rb +0 -3
  90. data/lib/mws/shipment_invoicing/client.rb +0 -74
  91. data/lib/mws/shipment_invoicing.rb +0 -3
  92. data/lib/mws/subscriptions/client.rb +0 -179
  93. data/lib/mws/subscriptions.rb +0 -3
  94. data/lib/mws.rb +0 -29
  95. data/lib/peddler/client.rb +0 -159
  96. data/lib/peddler/errors/builder.rb +0 -64
  97. data/lib/peddler/errors/class_generator.rb +0 -40
  98. data/lib/peddler/errors/error.rb +0 -45
  99. data/lib/peddler/errors/parser.rb +0 -28
  100. data/lib/peddler/flat_file_parser.rb +0 -56
  101. data/lib/peddler/headers.rb +0 -102
  102. data/lib/peddler/operation.rb +0 -78
  103. data/lib/peddler/parser.rb +0 -33
  104. data/lib/peddler/structured_list.rb +0 -23
  105. data/lib/peddler/vcr_matcher.rb +0 -97
  106. data/lib/peddler/xml_parser.rb +0 -38
  107. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def replenishment_2022_11_07(...)
8
+ API::Replenishment20221107.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Replenishment
14
+ #
15
+ # The Selling Partner API for Replenishment (Replenishment API) provides programmatic access to replenishment
16
+ # program metrics and offers. These programs provide recurring delivery of any replenishable item at a frequency
17
+ # chosen by the customer. The Replenishment API is available worldwide wherever Amazon Subscribe & Save is available
18
+ # or is supported. The API is available to vendors and FBA selling partners.
19
+ class Replenishment20221107 < API
20
+ # Returns aggregated replenishment program metrics for a selling partner.
21
+ #
22
+ # @note This operation can make a static sandbox call.
23
+ # @param body [Hash] The request body for the `getSellingPartnerMetrics` operation.
24
+ # @param rate_limit [Float] Requests per second
25
+ # @return [Hash] The API response
26
+ def get_selling_partner_metrics(body: nil, rate_limit: 1.0)
27
+ path = "/replenishment/2022-11-07/sellingPartners/metrics/search"
28
+
29
+ meter(rate_limit).post(path, body:)
30
+ end
31
+
32
+ # Returns aggregated replenishment program metrics for a selling partner's offers.
33
+ #
34
+ # @note This operation can make a static sandbox call.
35
+ # @param body [Hash] The request body for the `listOfferMetrics` operation.
36
+ # @param rate_limit [Float] Requests per second
37
+ # @return [Hash] The API response
38
+ def list_offer_metrics(body: nil, rate_limit: 1.0)
39
+ path = "/replenishment/2022-11-07/offers/metrics/search"
40
+
41
+ meter(rate_limit).post(path, body:)
42
+ end
43
+
44
+ # Returns the details of a selling partner's replenishment program offers.
45
+ #
46
+ # @note This operation can make a static sandbox call.
47
+ # @param body [Hash] The request body for the `listOffers` operation.
48
+ # @param rate_limit [Float] Requests per second
49
+ # @return [Hash] The API response
50
+ def list_offers(body: nil, rate_limit: 1.0)
51
+ path = "/replenishment/2022-11-07/offers/search"
52
+
53
+ meter(rate_limit).post(path, body:)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,163 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def reports_2021_06_30(...)
8
+ API::Reports20210630.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Reports
14
+ #
15
+ # The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling
16
+ # partners manage their businesses.
17
+ class Reports20210630 < API
18
+ # Returns report details for the reports that match the filters that you specify.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param report_types [Array<String>] A list of report types used to filter reports. Refer to [Report Type
22
+ # Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information. When
23
+ # reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince,
24
+ # createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required.
25
+ # @param processing_statuses [Array<String>] A list of processing statuses used to filter reports.
26
+ # @param marketplace_ids [Array<String>] A list of marketplace identifiers used to filter reports. The reports
27
+ # returned will match at least one of the marketplaces that you specify.
28
+ # @param page_size [Integer] The maximum number of reports to return in a single call.
29
+ # @param created_since [String] The earliest report creation date and time for reports to include in the response,
30
+ # in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} date time format. The default is 90 days
31
+ # ago. Reports are retained for a maximum of 90 days.
32
+ # @param created_until [String] The latest report creation date and time for reports to include in the response,
33
+ # in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} date time format. The default is now.
34
+ # @param next_token [String] A string token returned in the response to your previous request. `nextToken` is
35
+ # returned when the number of results exceeds the specified `pageSize` value. To get the next page of results,
36
+ # call the `getReports` operation and include this token as the only parameter. Specifying `nextToken` with any
37
+ # other parameters will cause the request to fail.
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Hash] The API response
40
+ def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size: 10,
41
+ created_since: nil, created_until: nil, next_token: nil, rate_limit: 0.0222)
42
+ path = "/reports/2021-06-30/reports"
43
+ params = {
44
+ "reportTypes" => report_types,
45
+ "processingStatuses" => processing_statuses,
46
+ "marketplaceIds" => marketplace_ids,
47
+ "pageSize" => page_size,
48
+ "createdSince" => created_since,
49
+ "createdUntil" => created_until,
50
+ "nextToken" => next_token,
51
+ }.compact
52
+
53
+ meter(rate_limit).get(path, params:)
54
+ end
55
+
56
+ # Creates a report.
57
+ #
58
+ # @note This operation can make a static sandbox call.
59
+ # @param body [Hash] Information required to create the report.
60
+ # @param rate_limit [Float] Requests per second
61
+ # @return [Hash] The API response
62
+ def create_report(body, rate_limit: 0.0167)
63
+ path = "/reports/2021-06-30/reports"
64
+
65
+ meter(rate_limit).post(path, body:)
66
+ end
67
+
68
+ # Cancels the report that you specify. Only reports with `processingStatus=IN_QUEUE` can be cancelled. Cancelled
69
+ # reports are returned in subsequent calls to the `getReport` and `getReports` operations.
70
+ #
71
+ # @note This operation can make a static sandbox call.
72
+ # @param report_id [String] The identifier for the report. This identifier is unique only in combination with a
73
+ # seller ID.
74
+ # @param rate_limit [Float] Requests per second
75
+ # @return [Hash] The API response
76
+ def cancel_report(report_id, rate_limit: 0.0222)
77
+ path = "/reports/2021-06-30/reports/#{report_id}"
78
+
79
+ meter(rate_limit).delete(path)
80
+ end
81
+
82
+ # Returns report details (including the `reportDocumentId`, if available) for the report that you specify.
83
+ #
84
+ # @note This operation can make a static sandbox call.
85
+ # @param report_id [String] The identifier for the report. This identifier is unique only in combination with a
86
+ # seller ID.
87
+ # @param rate_limit [Float] Requests per second
88
+ # @return [Hash] The API response
89
+ def get_report(report_id, rate_limit: 2.0)
90
+ path = "/reports/2021-06-30/reports/#{report_id}"
91
+
92
+ meter(rate_limit).get(path)
93
+ end
94
+
95
+ # Returns report schedule details that match the filters that you specify.
96
+ #
97
+ # @note This operation can make a static sandbox call.
98
+ # @param report_types [Array<String>] A list of report types used to filter report schedules. Refer to [Report
99
+ # Type Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information.
100
+ # @param rate_limit [Float] Requests per second
101
+ # @return [Hash] The API response
102
+ def get_report_schedules(report_types, rate_limit: 0.0222)
103
+ path = "/reports/2021-06-30/schedules"
104
+ params = {
105
+ "reportTypes" => report_types,
106
+ }.compact
107
+
108
+ meter(rate_limit).get(path, params:)
109
+ end
110
+
111
+ # Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it
112
+ # will be cancelled and replaced with this one.
113
+ #
114
+ # @note This operation can make a static sandbox call.
115
+ # @param body [Hash] Information required to create the report schedule.
116
+ # @param rate_limit [Float] Requests per second
117
+ # @return [Hash] The API response
118
+ def create_report_schedule(body, rate_limit: 0.0222)
119
+ path = "/reports/2021-06-30/schedules"
120
+
121
+ meter(rate_limit).post(path, body:)
122
+ end
123
+
124
+ # Cancels the report schedule that you specify.
125
+ #
126
+ # @note This operation can make a static sandbox call.
127
+ # @param report_schedule_id [String] The identifier for the report schedule. This identifier is unique only in
128
+ # combination with a seller ID.
129
+ # @param rate_limit [Float] Requests per second
130
+ # @return [Hash] The API response
131
+ def cancel_report_schedule(report_schedule_id, rate_limit: 0.0222)
132
+ path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
133
+
134
+ meter(rate_limit).delete(path)
135
+ end
136
+
137
+ # Returns report schedule details for the report schedule that you specify.
138
+ #
139
+ # @note This operation can make a static sandbox call.
140
+ # @param report_schedule_id [String] The identifier for the report schedule. This identifier is unique only in
141
+ # combination with a seller ID.
142
+ # @param rate_limit [Float] Requests per second
143
+ # @return [Hash] The API response
144
+ def get_report_schedule(report_schedule_id, rate_limit: 0.0222)
145
+ path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
146
+
147
+ meter(rate_limit).get(path)
148
+ end
149
+
150
+ # Returns the information required for retrieving a report document's contents.
151
+ #
152
+ # @note This operation can make a static sandbox call.
153
+ # @param report_document_id [String] The identifier for the report document.
154
+ # @param rate_limit [Float] Requests per second
155
+ # @return [Hash] The API response
156
+ def get_report_document(report_document_id, rate_limit: 0.0167)
157
+ path = "/reports/2021-06-30/documents/#{report_document_id}"
158
+
159
+ meter(rate_limit).get(path)
160
+ end
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def sales_v1(...)
8
+ API::SalesV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Sales
14
+ #
15
+ # The Selling Partner API for Sales provides APIs related to sales performance.
16
+ class SalesV1 < API
17
+ # Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.
18
+ #
19
+ # @note This operation can make a static sandbox call.
20
+ # @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
21
+ # order was placed. Only one marketplace can be specified. For example, ATVPDKIKX0DER indicates the US
22
+ # marketplace.
23
+ # @param interval [String] A time interval used for selecting order metrics. This takes the form of two dates
24
+ # separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and
25
+ # must represent absolute time (either Z notation or offset notation). Example:
26
+ # 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the
27
+ # -07:00 zone.
28
+ # @param granularity_time_zone [String] An IANA-compatible time zone for determining the day boundary. Required
29
+ # when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the
30
+ # offset of the specified interval value. For example, if the interval value uses Z notation, then
31
+ # granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an
32
+ # IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting
33
+ # for daylight time savings, for US/Pacific zone.
34
+ # @param granularity [String] The granularity of the grouping of order metrics, based on a unit of time.
35
+ # Specifying granularity=Hour results in a successful request only if the interval specified is less than or
36
+ # equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2
37
+ # years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire
38
+ # interval that you specify. If the interval start and end date don’t align with the specified granularity, the
39
+ # head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of
40
+ # the request interval, where the day boundary is defined by the granularityTimeZone.
41
+ # @param buyer_type [String] Filters the results by the buyer type that you specify, B2B (business to business) or
42
+ # B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B
43
+ # buyers.
44
+ # @param fulfillment_network [String] Filters the results by the fulfillment network that you specify, MFN
45
+ # (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the
46
+ # response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to
47
+ # include order metrics for only Amazon fulfillment network.
48
+ # @param first_day_of_week [String] Specifies the day that the week starts on when granularity=Week, either Monday
49
+ # or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
50
+ # @param asin [String] Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an
51
+ # error. Do not include this filter if you want the response to include order metrics for all ASINs. Example:
52
+ # B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
53
+ # @param sku [String] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an
54
+ # error. Do not include this filter if you want the response to include order metrics for all SKUs. Example:
55
+ # TestSKU, if you want the response to include order metrics for only SKU TestSKU.
56
+ # @param rate_limit [Float] Requests per second
57
+ # @return [Hash] The API response
58
+ def get_order_metrics(marketplace_ids, interval, granularity, granularity_time_zone: nil, buyer_type: "All",
59
+ fulfillment_network: nil, first_day_of_week: "Monday", asin: nil, sku: nil, rate_limit: 0.5)
60
+ path = "/sales/v1/orderMetrics"
61
+ params = {
62
+ "marketplaceIds" => marketplace_ids,
63
+ "interval" => interval,
64
+ "granularityTimeZone" => granularity_time_zone,
65
+ "granularity" => granularity,
66
+ "buyerType" => buyer_type,
67
+ "fulfillmentNetwork" => fulfillment_network,
68
+ "firstDayOfWeek" => first_day_of_week,
69
+ "asin" => asin,
70
+ "sku" => sku,
71
+ }.compact
72
+
73
+ meter(rate_limit).get(path, params:)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def sellers_v1(...)
8
+ API::SellersV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Sellers
14
+ #
15
+ # The [Selling Partner API for Sellers](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference)
16
+ # (Sellers API) provides essential information about seller accounts, such as: - The marketplaces a seller can list
17
+ # in - The default language and currency of a marketplace - Whether the seller has suspended listings Refer to the
18
+ # [Sellers API reference](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference) for details about
19
+ # this API's operations, data types, and schemas.
20
+ class SellersV1 < API
21
+ # Returns a list of marketplaces where the seller can list items and information about the seller's participation
22
+ # in those marketplaces.
23
+ #
24
+ # @note This operation can make a static sandbox call.
25
+ # @param rate_limit [Float] Requests per second
26
+ # @return [Hash] The API response
27
+ def get_marketplace_participations(rate_limit: 0.016)
28
+ path = "/sellers/v1/marketplaceParticipations"
29
+
30
+ meter(rate_limit).get(path)
31
+ end
32
+
33
+ # Returns information about a seller account and its marketplaces.
34
+ #
35
+ # @note This operation can make a static sandbox call.
36
+ # @param rate_limit [Float] Requests per second
37
+ # @return [Hash] The API response
38
+ def get_account(rate_limit: 0.016)
39
+ path = "/sellers/v1/account"
40
+
41
+ meter(rate_limit).get(path)
42
+ end
43
+ end
44
+ end
45
+ end