peddler 2.4.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +406 -134
  3. data/lib/peddler/access_token.rb +76 -0
  4. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
  5. data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +90 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +106 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
  15. data/lib/peddler/api/finances_v0.rb +121 -0
  16. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
  17. data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
  18. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
  19. data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
  20. data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
  21. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
  22. data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
  23. data/lib/peddler/api/messaging_v1.rb +241 -0
  24. data/lib/peddler/api/notifications_v1.rb +114 -0
  25. data/lib/peddler/api/orders_v0.rb +264 -0
  26. data/lib/peddler/api/product_fees_v0.rb +69 -0
  27. data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
  28. data/lib/peddler/api/product_pricing_v0.rb +144 -0
  29. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
  30. data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
  31. data/lib/peddler/api/reports_2021_06_30.rb +139 -0
  32. data/lib/peddler/api/sales_v1.rb +69 -0
  33. data/lib/peddler/api/sellers_v1.rb +33 -0
  34. data/lib/peddler/api/services_v1.rb +308 -0
  35. data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
  36. data/lib/peddler/api/shipping_v1.rb +107 -0
  37. data/lib/peddler/api/shipping_v2.rb +267 -0
  38. data/lib/peddler/api/solicitations_v1.rb +53 -0
  39. data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
  40. data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
  41. data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
  42. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
  43. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
  51. data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
  52. data/lib/peddler/api/vendor_orders_v1.rb +148 -0
  53. data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
  54. data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
  55. data/lib/peddler/api.rb +115 -0
  56. data/lib/peddler/error.rb +30 -0
  57. data/lib/peddler/region.rb +30 -0
  58. data/lib/peddler/version.rb +1 -1
  59. data/lib/peddler.rb +52 -1
  60. metadata +70 -80
  61. data/lib/mws/easy_ship/client.rb +0 -93
  62. data/lib/mws/easy_ship.rb +0 -3
  63. data/lib/mws/feeds/client.rb +0 -122
  64. data/lib/mws/feeds.rb +0 -3
  65. data/lib/mws/finances/client.rb +0 -82
  66. data/lib/mws/finances.rb +0 -3
  67. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  68. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  69. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  70. data/lib/mws/fulfillment_inventory.rb +0 -3
  71. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  72. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  73. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  74. data/lib/mws/merchant_fulfillment.rb +0 -3
  75. data/lib/mws/off_amazon_payments.rb +0 -3
  76. data/lib/mws/orders/client.rb +0 -120
  77. data/lib/mws/orders.rb +0 -3
  78. data/lib/mws/products/client.rb +0 -268
  79. data/lib/mws/products.rb +0 -3
  80. data/lib/mws/recommendations/client.rb +0 -72
  81. data/lib/mws/recommendations.rb +0 -3
  82. data/lib/mws/reports/client.rb +0 -236
  83. data/lib/mws/reports.rb +0 -3
  84. data/lib/mws/sellers/client.rb +0 -44
  85. data/lib/mws/sellers.rb +0 -3
  86. data/lib/mws/shipment_invoicing/client.rb +0 -74
  87. data/lib/mws/shipment_invoicing.rb +0 -3
  88. data/lib/mws/subscriptions/client.rb +0 -179
  89. data/lib/mws/subscriptions.rb +0 -3
  90. data/lib/mws.rb +0 -29
  91. data/lib/peddler/client.rb +0 -159
  92. data/lib/peddler/errors/builder.rb +0 -64
  93. data/lib/peddler/errors/class_generator.rb +0 -40
  94. data/lib/peddler/errors/error.rb +0 -45
  95. data/lib/peddler/errors/parser.rb +0 -28
  96. data/lib/peddler/flat_file_parser.rb +0 -56
  97. data/lib/peddler/headers.rb +0 -102
  98. data/lib/peddler/marketplace.rb +0 -78
  99. data/lib/peddler/operation.rb +0 -78
  100. data/lib/peddler/parser.rb +0 -33
  101. data/lib/peddler/structured_list.rb +0 -23
  102. data/lib/peddler/vcr_matcher.rb +0 -97
  103. data/lib/peddler/xml_parser.rb +0 -38
  104. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Reports
8
+ #
9
+ # The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling
10
+ # partners manage their businesses.
11
+ class Reports20210630 < API
12
+ # Returns report details for the reports that match the filters that you specify.
13
+ #
14
+ # @param [Array<String>] report_types A list of report types used to filter reports. Refer to [Report Type
15
+ # Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information. When
16
+ # reportTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince,
17
+ # createdUntil) and pageSize may also be provided. Either reportTypes or nextToken is required.
18
+ # @param [Array<String>] processing_statuses A list of processing statuses used to filter reports.
19
+ # @param [Array<String>] marketplace_ids A list of marketplace identifiers used to filter reports. The reports
20
+ # returned will match at least one of the marketplaces that you specify.
21
+ # @param [Integer] page_size The maximum number of reports to return in a single call.
22
+ # @param [String] created_since The earliest report creation date and time for reports to include in the response,
23
+ # in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. The default is 90 days
24
+ # ago. Reports are retained for a maximum of 90 days.
25
+ # @param [String] created_until The latest report creation date and time for reports to include in the response,
26
+ # in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format. The default is now.
27
+ # @param [String] next_token A string token returned in the response to your previous request. `nextToken` is
28
+ # returned when the number of results exceeds the specified `pageSize` value. To get the next page of results,
29
+ # call the `getReports` operation and include this token as the only parameter. Specifying `nextToken` with any
30
+ # other parameters will cause the request to fail.
31
+ # @return [Hash] The API response
32
+ def get_reports(report_types: nil, processing_statuses: nil, marketplace_ids: nil, page_size: nil,
33
+ created_since: nil, created_until: nil, next_token: nil)
34
+ path = "/reports/2021-06-30/reports"
35
+ params = {
36
+ "reportTypes" => report_types,
37
+ "processingStatuses" => processing_statuses,
38
+ "marketplaceIds" => marketplace_ids,
39
+ "pageSize" => page_size,
40
+ "createdSince" => created_since,
41
+ "createdUntil" => created_until,
42
+ "nextToken" => next_token,
43
+ }.compact
44
+
45
+ rate_limit(0.0222).get(path, params:)
46
+ end
47
+
48
+ # Creates a report.
49
+ #
50
+ # @param [Hash] body Information required to create the report.
51
+ # @return [Hash] The API response
52
+ def create_report(body)
53
+ path = "/reports/2021-06-30/reports"
54
+
55
+ rate_limit(0.0167).post(path, body:)
56
+ end
57
+
58
+ # Cancels the report that you specify. Only reports with `processingStatus=IN_QUEUE` can be cancelled. Cancelled
59
+ # reports are returned in subsequent calls to the `getReport` and `getReports` operations.
60
+ #
61
+ # @param [String] report_id The identifier for the report. This identifier is unique only in combination with a
62
+ # seller ID.
63
+ # @return [Hash] The API response
64
+ def cancel_report(report_id)
65
+ path = "/reports/2021-06-30/reports/#{report_id}"
66
+
67
+ rate_limit(0.0222).delete(path)
68
+ end
69
+
70
+ # Returns report details (including the `reportDocumentId`, if available) for the report that you specify.
71
+ #
72
+ # @param [String] report_id The identifier for the report. This identifier is unique only in combination with a
73
+ # seller ID.
74
+ # @return [Hash] The API response
75
+ def get_report(report_id)
76
+ path = "/reports/2021-06-30/reports/#{report_id}"
77
+
78
+ rate_limit(2.0).get(path)
79
+ end
80
+
81
+ # Returns report schedule details that match the filters that you specify.
82
+ #
83
+ # @param [Array<String>] report_types A list of report types used to filter report schedules. Refer to [Report
84
+ # Type Values](https://developer-docs.amazon.com/sp-api/docs/report-type-values) for more information.
85
+ # @return [Hash] The API response
86
+ def get_report_schedules(report_types)
87
+ path = "/reports/2021-06-30/schedules"
88
+ params = {
89
+ "reportTypes" => report_types,
90
+ }.compact
91
+
92
+ rate_limit(0.0222).get(path, params:)
93
+ end
94
+
95
+ # Creates a report schedule. If a report schedule with the same report type and marketplace IDs already exists, it
96
+ # will be cancelled and replaced with this one.
97
+ #
98
+ # @param [Hash] body Information required to create the report schedule.
99
+ # @return [Hash] The API response
100
+ def create_report_schedule(body)
101
+ path = "/reports/2021-06-30/schedules"
102
+
103
+ rate_limit(0.0222).post(path, body:)
104
+ end
105
+
106
+ # Cancels the report schedule that you specify.
107
+ #
108
+ # @param [String] report_schedule_id The identifier for the report schedule. This identifier is unique only in
109
+ # combination with a seller ID.
110
+ # @return [Hash] The API response
111
+ def cancel_report_schedule(report_schedule_id)
112
+ path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
113
+
114
+ rate_limit(0.0222).delete(path)
115
+ end
116
+
117
+ # Returns report schedule details for the report schedule that you specify.
118
+ #
119
+ # @param [String] report_schedule_id The identifier for the report schedule. This identifier is unique only in
120
+ # combination with a seller ID.
121
+ # @return [Hash] The API response
122
+ def get_report_schedule(report_schedule_id)
123
+ path = "/reports/2021-06-30/schedules/#{report_schedule_id}"
124
+
125
+ rate_limit(0.0222).get(path)
126
+ end
127
+
128
+ # Returns the information required for retrieving a report document's contents.
129
+ #
130
+ # @param [String] report_document_id The identifier for the report document.
131
+ # @return [Hash] The API response
132
+ def get_report_document(report_document_id)
133
+ path = "/reports/2021-06-30/documents/#{report_document_id}"
134
+
135
+ rate_limit(0.0167).get(path)
136
+ end
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Sales
8
+ #
9
+ # The Selling Partner API for Sales provides APIs related to sales performance.
10
+ class SalesV1 < API
11
+ # Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.
12
+ #
13
+ # @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
14
+ # order was placed. Only one marketplace can be specified. For example, ATVPDKIKX0DER indicates the US
15
+ # marketplace.
16
+ # @param [String] interval A time interval used for selecting order metrics. This takes the form of two dates
17
+ # separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and
18
+ # must represent absolute time (either Z notation or offset notation). Example:
19
+ # 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
20
+ # -07:00 zone.
21
+ # @param [String] granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required
22
+ # when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the
23
+ # offset of the specified interval value. For example, if the interval value uses Z notation, then
24
+ # granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an
25
+ # IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting
26
+ # for daylight time savings, for US/Pacific zone.
27
+ # @param [String] granularity The granularity of the grouping of order metrics, based on a unit of time.
28
+ # Specifying granularity=Hour results in a successful request only if the interval specified is less than or
29
+ # equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2
30
+ # years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire
31
+ # interval that you specify. If the interval start and end date don’t align with the specified granularity, the
32
+ # head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of
33
+ # the request interval, where the day boundary is defined by the granularityTimeZone.
34
+ # @param [String] buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or
35
+ # B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B
36
+ # buyers.
37
+ # @param [String] fulfillment_network Filters the results by the fulfillment network that you specify, MFN
38
+ # (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the
39
+ # response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to
40
+ # include order metrics for only Amazon fulfillment network.
41
+ # @param [String] first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday
42
+ # or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.
43
+ # @param [String] asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an
44
+ # error. Do not include this filter if you want the response to include order metrics for all ASINs. Example:
45
+ # B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.
46
+ # @param [String] sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an
47
+ # error. Do not include this filter if you want the response to include order metrics for all SKUs. Example:
48
+ # TestSKU, if you want the response to include order metrics for only SKU TestSKU.
49
+ # @return [Hash] The API response
50
+ def get_order_metrics(marketplace_ids, interval, granularity, granularity_time_zone: nil, buyer_type: nil,
51
+ fulfillment_network: nil, first_day_of_week: nil, asin: nil, sku: nil)
52
+ path = "/sales/v1/orderMetrics"
53
+ params = {
54
+ "marketplaceIds" => marketplace_ids,
55
+ "interval" => interval,
56
+ "granularityTimeZone" => granularity_time_zone,
57
+ "granularity" => granularity,
58
+ "buyerType" => buyer_type,
59
+ "fulfillmentNetwork" => fulfillment_network,
60
+ "firstDayOfWeek" => first_day_of_week,
61
+ "asin" => asin,
62
+ "sku" => sku,
63
+ }.compact
64
+
65
+ rate_limit(0.5).get(path, params:)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Sellers
8
+ #
9
+ # The [Selling Partner API for Sellers](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference)
10
+ # (Sellers API) provides essential information about seller accounts, such as: - The marketplaces a seller can list
11
+ # in - The default language and currency of a marketplace - Whether the seller has suspended listings Refer to the
12
+ # [Sellers API reference](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference) for details about
13
+ # this API's operations, data types, and schemas.
14
+ class SellersV1 < API
15
+ # Returns a list of marketplaces where the seller can list items and information about the seller's participation
16
+ # in those marketplaces.
17
+ # @return [Hash] The API response
18
+ def get_marketplace_participations
19
+ path = "/sellers/v1/marketplaceParticipations"
20
+
21
+ rate_limit(0.016).get(path)
22
+ end
23
+
24
+ # Returns information about a seller account and its marketplaces.
25
+ # @return [Hash] The API response
26
+ def get_account
27
+ path = "/sellers/v1/account"
28
+
29
+ rate_limit(0.016).get(path)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,308 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Services
8
+ #
9
+ # With the Services API, you can build applications that help service providers get and modify their service orders
10
+ # and manage their resources.
11
+ class ServicesV1 < API
12
+ # Gets details of service job indicated by the provided `serviceJobID`.
13
+ #
14
+ # @param [String] service_job_id A service job identifier.
15
+ # @return [Hash] The API response
16
+ def get_service_job_by_service_job_id(service_job_id)
17
+ path = "/service/v1/serviceJobs/#{service_job_id}"
18
+
19
+ rate_limit(20.0).get(path)
20
+ end
21
+
22
+ # Cancels the service job indicated by the service job identifier specified.
23
+ #
24
+ # @param [String] service_job_id An Amazon defined service job identifier.
25
+ # @param [String] cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service
26
+ # job.
27
+ # @return [Hash] The API response
28
+ def cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code)
29
+ path = "/service/v1/serviceJobs/#{service_job_id}/cancellations"
30
+ params = {
31
+ "cancellationReasonCode" => cancellation_reason_code,
32
+ }.compact
33
+
34
+ rate_limit(5.0).put(path, params:)
35
+ end
36
+
37
+ # Completes the service job indicated by the service job identifier specified.
38
+ #
39
+ # @param [String] service_job_id An Amazon defined service job identifier.
40
+ # @return [Hash] The API response
41
+ def complete_service_job_by_service_job_id(service_job_id)
42
+ path = "/service/v1/serviceJobs/#{service_job_id}/completions"
43
+
44
+ rate_limit(5.0).put(path)
45
+ end
46
+
47
+ # Gets service job details for the specified filter query.
48
+ #
49
+ # @param [Array<String>] service_order_ids List of service order ids for the query you want to perform.Max values
50
+ # supported 20.
51
+ # @param [Array<String>] service_job_status A list of one or more job status by which to filter the list of jobs.
52
+ # @param [String] page_token String returned in the response of your previous request.
53
+ # @param [Integer] page_size A non-negative integer that indicates the maximum number of jobs to return in the
54
+ # list, Value must be 1 - 20. Default 20.
55
+ # @param [String] sort_field Sort fields on which you want to sort the output.
56
+ # @param [String] sort_order Sort order for the query you want to perform.
57
+ # @param [String] created_after A date used for selecting jobs created at or after a specified time. Must be in
58
+ # ISO 8601 format. Required if `LastUpdatedAfter` is not specified. Specifying both `CreatedAfter` and
59
+ # `LastUpdatedAfter` returns an error.
60
+ # @param [String] created_before A date used for selecting jobs created at or before a specified time. Must be in
61
+ # ISO 8601 format.
62
+ # @param [String] last_updated_after A date used for selecting jobs updated at or after a specified time. Must be
63
+ # in ISO 8601 format. Required if `createdAfter` is not specified. Specifying both `CreatedAfter` and
64
+ # `LastUpdatedAfter` returns an error.
65
+ # @param [String] last_updated_before A date used for selecting jobs updated at or before a specified time. Must
66
+ # be in ISO 8601 format.
67
+ # @param [String] schedule_start_date A date used for filtering jobs schedules at or after a specified time. Must
68
+ # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
69
+ # @param [String] schedule_end_date A date used for filtering jobs schedules at or before a specified time. Must
70
+ # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
71
+ # @param [Array<String>] marketplace_ids Used to select jobs that were placed in the specified marketplaces.
72
+ # @param [Array<String>] asins List of Amazon Standard Identification Numbers (ASIN) of the items. Max values
73
+ # supported is 20.
74
+ # @param [Array<String>] required_skills A defined set of related knowledge, skills, experience, tools, materials,
75
+ # and work processes common to service delivery for a set of products and/or service scenarios. Max values
76
+ # supported is 20.
77
+ # @param [Array<String>] store_ids List of Amazon-defined identifiers for the region scope. Max values supported
78
+ # is 50.
79
+ # @return [Hash] The API response
80
+ def get_service_jobs(
81
+ marketplace_ids, service_order_ids: nil, service_job_status: nil, page_token: nil, page_size: nil,
82
+ sort_field: nil, sort_order: nil, created_after: nil, created_before: nil, last_updated_after: nil,
83
+ last_updated_before: nil, schedule_start_date: nil, schedule_end_date: nil, asins: nil, required_skills: nil,
84
+ store_ids: nil
85
+ )
86
+ path = "/service/v1/serviceJobs"
87
+ params = {
88
+ "serviceOrderIds" => service_order_ids,
89
+ "serviceJobStatus" => service_job_status,
90
+ "pageToken" => page_token,
91
+ "pageSize" => page_size,
92
+ "sortField" => sort_field,
93
+ "sortOrder" => sort_order,
94
+ "createdAfter" => created_after,
95
+ "createdBefore" => created_before,
96
+ "lastUpdatedAfter" => last_updated_after,
97
+ "lastUpdatedBefore" => last_updated_before,
98
+ "scheduleStartDate" => schedule_start_date,
99
+ "scheduleEndDate" => schedule_end_date,
100
+ "marketplaceIds" => marketplace_ids,
101
+ "asins" => asins,
102
+ "requiredSkills" => required_skills,
103
+ "storeIds" => store_ids,
104
+ }.compact
105
+
106
+ rate_limit(10.0).get(path, params:)
107
+ end
108
+
109
+ # Adds an appointment to the service job indicated by the service job identifier specified.
110
+ #
111
+ # @param [String] service_job_id An Amazon defined service job identifier.
112
+ # @param [Hash] body Add appointment operation input details.
113
+ # @return [Hash] The API response
114
+ def add_appointment_for_service_job_by_service_job_id(service_job_id, body)
115
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointments"
116
+
117
+ rate_limit(5.0).post(path, body:)
118
+ end
119
+
120
+ # Reschedules an appointment for the service job indicated by the service job identifier specified.
121
+ #
122
+ # @param [String] service_job_id An Amazon defined service job identifier.
123
+ # @param [String] appointment_id An existing appointment identifier for the Service Job.
124
+ # @param [Hash] body Reschedule appointment operation input details.
125
+ # @return [Hash] The API response
126
+ def reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body)
127
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}"
128
+
129
+ rate_limit(5.0).post(path, body:)
130
+ end
131
+
132
+ # Assigns new resource(s) or overwrite/update the existing one(s) to a service job appointment.
133
+ #
134
+ # @param [String] service_job_id An Amazon-defined service job identifier. Get this value by calling the
135
+ # `getServiceJobs` operation of the Services API.
136
+ # @param [String] appointment_id An Amazon-defined identifier of active service job appointment.
137
+ # @param [Hash] body
138
+ # @return [Hash] The API response
139
+ def assign_appointment_resources(service_job_id, appointment_id, body)
140
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/resources"
141
+
142
+ rate_limit(1.0).put(path, body:)
143
+ end
144
+
145
+ # Updates the appointment fulfillment data related to a given `jobID` and `appointmentID`.
146
+ #
147
+ # @param [String] service_job_id An Amazon-defined service job identifier. Get this value by calling the
148
+ # `getServiceJobs` operation of the Services API.
149
+ # @param [String] appointment_id An Amazon-defined identifier of active service job appointment.
150
+ # @param [Hash] body Appointment fulfillment data collection details.
151
+ # @return [Hash] The API response
152
+ def set_appointment_fulfillment_data(service_job_id, appointment_id, body)
153
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/fulfillment"
154
+
155
+ rate_limit(5.0).put(path, body:)
156
+ end
157
+
158
+ # Provides capacity slots in a format similar to availability records.
159
+ #
160
+ # @param [String] resource_id Resource Identifier.
161
+ # @param [Hash] body Request body.
162
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
163
+ # @param [String] next_page_token Next page token returned in the response of your previous request.
164
+ # @return [Hash] The API response
165
+ def get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil)
166
+ path = "/service/v1/serviceResources/#{resource_id}/capacity/range"
167
+ params = {
168
+ "marketplaceIds" => marketplace_ids,
169
+ "nextPageToken" => next_page_token,
170
+ }.compact
171
+
172
+ rate_limit(5.0).post(path, body:, params:)
173
+ end
174
+
175
+ # Provides capacity in fixed-size slots.
176
+ #
177
+ # @param [String] resource_id Resource Identifier.
178
+ # @param [Hash] body Request body.
179
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
180
+ # @param [String] next_page_token Next page token returned in the response of your previous request.
181
+ # @return [Hash] The API response
182
+ def get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil)
183
+ path = "/service/v1/serviceResources/#{resource_id}/capacity/fixed"
184
+ params = {
185
+ "marketplaceIds" => marketplace_ids,
186
+ "nextPageToken" => next_page_token,
187
+ }.compact
188
+
189
+ rate_limit(5.0).post(path, body:, params:)
190
+ end
191
+
192
+ # Update the schedule of the given resource.
193
+ #
194
+ # @param [String] resource_id Resource (store) Identifier
195
+ # @param [Hash] body Schedule details
196
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
197
+ # @return [Hash] The API response
198
+ def update_schedule(resource_id, body, marketplace_ids)
199
+ path = "/service/v1/serviceResources/#{resource_id}/schedules"
200
+ params = {
201
+ "marketplaceIds" => marketplace_ids,
202
+ }.compact
203
+
204
+ rate_limit(5.0).put(path, body:, params:)
205
+ end
206
+
207
+ # Create a reservation.
208
+ #
209
+ # @param [Hash] body Reservation details
210
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
211
+ # @return [Hash] The API response
212
+ def create_reservation(body, marketplace_ids)
213
+ path = "/service/v1/reservation"
214
+ params = {
215
+ "marketplaceIds" => marketplace_ids,
216
+ }.compact
217
+
218
+ rate_limit(5.0).post(path, body:, params:)
219
+ end
220
+
221
+ # Update a reservation.
222
+ #
223
+ # @param [String] reservation_id Reservation Identifier
224
+ # @param [Hash] body Reservation details
225
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
226
+ # @return [Hash] The API response
227
+ def update_reservation(reservation_id, body, marketplace_ids)
228
+ path = "/service/v1/reservation/#{reservation_id}"
229
+ params = {
230
+ "marketplaceIds" => marketplace_ids,
231
+ }.compact
232
+
233
+ rate_limit(5.0).put(path, body:, params:)
234
+ end
235
+
236
+ # Cancel a reservation.
237
+ #
238
+ # @param [String] reservation_id Reservation Identifier
239
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
240
+ # @return [Hash] The API response
241
+ def cancel_reservation(reservation_id, marketplace_ids)
242
+ path = "/service/v1/reservation/#{reservation_id}"
243
+ params = {
244
+ "marketplaceIds" => marketplace_ids,
245
+ }.compact
246
+
247
+ rate_limit(5.0).delete(path, params:)
248
+ end
249
+
250
+ # Gets appointment slots for the service associated with the service job id specified.
251
+ #
252
+ # @param [String] service_job_id A service job identifier to retrive appointment slots for associated service.
253
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
254
+ # @param [String] start_time A time from which the appointment slots will be retrieved. The specified time must be
255
+ # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
256
+ # business configuration.
257
+ # @param [String] end_time A time up to which the appointment slots will be retrieved. The specified time must be
258
+ # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
259
+ # business configuration. Maximum range of appointment slots can be 90 days.
260
+ # @return [Hash] The API response
261
+ def get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil)
262
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointmentSlots"
263
+ params = {
264
+ "marketplaceIds" => marketplace_ids,
265
+ "startTime" => start_time,
266
+ "endTime" => end_time,
267
+ }.compact
268
+
269
+ rate_limit(5.0).get(path, params:)
270
+ end
271
+
272
+ # Gets appointment slots as per the service context specified.
273
+ #
274
+ # @param [String] asin ASIN associated with the service.
275
+ # @param [String] store_id Store identifier defining the region scope to retrive appointment slots.
276
+ # @param [Array<String>] marketplace_ids An identifier for the marketplace for which appointment slots are queried
277
+ # @param [String] start_time A time from which the appointment slots will be retrieved. The specified time must be
278
+ # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
279
+ # business configuration.
280
+ # @param [String] end_time A time up to which the appointment slots will be retrieved. The specified time must be
281
+ # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
282
+ # business configuration. Maximum range of appointment slots can be 90 days.
283
+ # @return [Hash] The API response
284
+ def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil)
285
+ path = "/service/v1/appointmentSlots"
286
+ params = {
287
+ "asin" => asin,
288
+ "storeId" => store_id,
289
+ "marketplaceIds" => marketplace_ids,
290
+ "startTime" => start_time,
291
+ "endTime" => end_time,
292
+ }.compact
293
+
294
+ rate_limit(20.0).get(path, params:)
295
+ end
296
+
297
+ # Creates an upload destination.
298
+ #
299
+ # @param [Hash] body Upload document operation input details.
300
+ # @return [Hash] The API response
301
+ def create_service_document_upload_destination(body)
302
+ path = "/service/v1/documents"
303
+
304
+ rate_limit(5.0).post(path, body:)
305
+ end
306
+ end
307
+ end
308
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Shipment Invoicing
8
+ #
9
+ # The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in
10
+ # the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders.
11
+ class ShipmentInvoicingV0 < API
12
+ # Returns the shipment details required to issue an invoice for the specified shipment.
13
+ #
14
+ # @param [String] shipment_id The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus
15
+ # notification. For information about subscribing to notifications, see the [Notifications API Use Case
16
+ # Guide](doc:notifications-api-v1-use-case-guide).
17
+ # @return [Hash] The API response
18
+ def get_shipment_details(shipment_id)
19
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}"
20
+
21
+ rate_limit(1.133).get(path)
22
+ end
23
+
24
+ # Submits a shipment invoice document for a given shipment.
25
+ #
26
+ # @param [String] shipment_id The identifier for the shipment.
27
+ # @param [Hash] body
28
+ # @return [Hash] The API response
29
+ def submit_invoice(shipment_id, body)
30
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice"
31
+
32
+ rate_limit(1.133).post(path, body:)
33
+ end
34
+
35
+ # Returns the invoice status for the shipment you specify.
36
+ #
37
+ # @param [String] shipment_id The shipment identifier for the shipment.
38
+ # @return [Hash] The API response
39
+ def get_invoice_status(shipment_id)
40
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice/status"
41
+
42
+ rate_limit(1.133).get(path)
43
+ end
44
+ end
45
+ end
46
+ end