muffin_man 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/muffin_man/fulfillment_outbound/v20200701.rb +56 -0
- data/lib/muffin_man/request_helpers/base.rb +3 -0
- data/lib/muffin_man/request_helpers/outbound_fulfillment/address.rb +92 -0
- data/lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb +104 -0
- data/lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_preview_request.rb +64 -0
- data/lib/muffin_man/request_helpers/outbound_fulfillment/item.rb +69 -0
- data/lib/muffin_man/request_helpers/outbound_fulfillment/v20200701.rb +41 -0
- data/lib/muffin_man/request_helpers.rb +1 -0
- data/lib/muffin_man/sp_api_client.rb +6 -0
- data/lib/muffin_man/version.rb +1 -1
- data/lib/muffin_man.rb +3 -1
- data/muffin_man.gemspec +1 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a65842148ee282b6d12a552b0c55495a445b183e5a7e5c38a7418de04992f999
|
4
|
+
data.tar.gz: 383a57d029e7f7938d451698a69a60b808f6fccc9fab074fa0e2d710df3acd2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7993f0f6103ab852b70a457a4b5d29b028e40a3b53c98c169a28336653035dbb70ebdb988000fb6df04595362257924164b63a1cc2e0ea76dc1ba201c8a57245
|
7
|
+
data.tar.gz: 8f7ccf13026f77ea995fabf36d0c753714daea1ccfdfee63276a17693e86ed8d25466246a00017832050915ada192fa4dfd677d342cbcee1c88d5afeafa029e1
|
data/.rubocop_todo.yml
CHANGED
@@ -159,6 +159,7 @@ Lint/MissingSuper:
|
|
159
159
|
Exclude:
|
160
160
|
- 'lib/muffin_man/request_helpers/inbound_shipment_plan_request_item.rb'
|
161
161
|
|
162
|
+
|
162
163
|
# Offense count: 17
|
163
164
|
# This cop supports safe autocorrection (--autocorrect).
|
164
165
|
# Configuration parameters: EnforcedStyle.
|
@@ -254,6 +255,7 @@ RSpec/FilePath:
|
|
254
255
|
- 'spec/muffin_man/solicitations_spec.rb'
|
255
256
|
- 'spec/muffin_man/tokens_spec.rb'
|
256
257
|
|
258
|
+
|
257
259
|
# Offense count: 15
|
258
260
|
# This cop supports safe autocorrection (--autocorrect).
|
259
261
|
RSpec/LeadingSubject:
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
- Support for getInventorySummaries [#36](https://github.com/patterninc/muffin_man/pull/36)
|
4
4
|
|
5
|
+
# 1.5.3
|
6
|
+
|
7
|
+
- Support for Fulfillment Outbound [#34](https://github.com/patterninc/muffin_man/pull/34)
|
8
|
+
|
5
9
|
# 1.5.2
|
6
10
|
|
7
11
|
- Support for Feeds and Notifications [#33](https://github.com/patterninc/muffin_man/pull/33)
|
data/README.md
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module FulfillmentOutbound
|
5
|
+
class V20200701 < SpApiClient
|
6
|
+
# @param [MuffinMan::RequestHelpers::OutboundFulFillment::FulfillmentPreviewRequest] fulfillment_preview_request
|
7
|
+
# in the form of object
|
8
|
+
def get_fulfillment_preview(fulfillment_preview_request)
|
9
|
+
return unprocessable_entity(fulfillment_preview_request&.errors) unless fulfillment_preview_request&.valid?
|
10
|
+
|
11
|
+
@local_var_path = "/fba/outbound/2020-07-01/fulfillmentOrders/preview"
|
12
|
+
@request_body = fulfillment_preview_request.to_camelize
|
13
|
+
@request_type = "POST"
|
14
|
+
call_api
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param [MuffinMan::RequestHelpers::OutboundFulFillment::FulfillmentOrderRequest] fulfillment_order_request
|
18
|
+
# in the form of object
|
19
|
+
def create_fulfillment_order(fulfillment_order_request)
|
20
|
+
return unprocessable_entity(fulfillment_order_request&.errors) unless fulfillment_order_request&.valid?
|
21
|
+
|
22
|
+
@local_var_path = "/fba/outbound/2020-07-01/fulfillmentOrders"
|
23
|
+
@request_body = fulfillment_order_request.to_camelize
|
24
|
+
@request_type = "POST"
|
25
|
+
call_api
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [String] query_start_date optional
|
29
|
+
# @param [String] next_token optional
|
30
|
+
def list_all_fulfillment_orders(query_start_date: nil, next_token: nil)
|
31
|
+
@local_var_path = "/fba/outbound/2020-07-01/fulfillmentOrders"
|
32
|
+
|
33
|
+
@query_params = {} unless query_start_date.nil? && next_token.nil?
|
34
|
+
|
35
|
+
@query_params[:queryStartDate] = query_start_date unless query_start_date.nil?
|
36
|
+
@query_params[:nextToken] = next_token unless next_token.nil?
|
37
|
+
@request_type = "GET"
|
38
|
+
call_api
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param [String] seller_fulfillment_order_id
|
42
|
+
def get_fulfillment_order(seller_fulfillment_order_id)
|
43
|
+
@local_var_path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}"
|
44
|
+
@request_type = "GET"
|
45
|
+
call_api
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param [String] seller_fulfillment_order_id
|
49
|
+
def cancel_fulfillment_order(seller_fulfillment_order_id)
|
50
|
+
@local_var_path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/cancel"
|
51
|
+
@request_type = "PUT"
|
52
|
+
call_api
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module RequestHelpers
|
5
|
+
module OutboundFulfillment
|
6
|
+
class Address < MuffinMan::RequestHelpers::Base
|
7
|
+
attr_accessor :name, :address_line1, :address_line2, :address_line3, :city,
|
8
|
+
:district_or_county, :state_or_region, :country_code, :postal_code, :phone
|
9
|
+
|
10
|
+
# Initializes the object
|
11
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
12
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
13
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
14
|
+
def initialize(attributes = {})
|
15
|
+
super
|
16
|
+
return unless attributes.is_a?(Hash)
|
17
|
+
|
18
|
+
attributes = attributes.with_indifferent_access
|
19
|
+
|
20
|
+
self.name = attributes["name"] if attributes.key?("name")
|
21
|
+
|
22
|
+
if attributes.key?("address_line1") || attributes.key?("line1")
|
23
|
+
self.address_line1 = attributes["address_line1"] || attributes["line1"]
|
24
|
+
end
|
25
|
+
|
26
|
+
if attributes.key?("address_line2") || attributes.key?("line2")
|
27
|
+
self.address_line2 = attributes["address_line2"] || attributes["line2"]
|
28
|
+
end
|
29
|
+
|
30
|
+
if attributes.key?("address_line3") || attributes.key?("line3")
|
31
|
+
self.address_line3 = attributes["address_line3"] || attributes("line3")
|
32
|
+
end
|
33
|
+
|
34
|
+
self.city = attributes["city"] if attributes.key?("city")
|
35
|
+
|
36
|
+
self.district_or_county = attributes["district_or_county"] if attributes.key?("district_or_county")
|
37
|
+
|
38
|
+
if attributes.key?("state_or_region") || attributes.key?("state_or_province_code")
|
39
|
+
self.state_or_region = attributes["state_or_region"] || attributes["state_or_province_code"]
|
40
|
+
end
|
41
|
+
|
42
|
+
self.postal_code = attributes["postal_code"] if attributes.key?("postal_code")
|
43
|
+
|
44
|
+
self.country_code = attributes["country_code"] if attributes.key?("country_code")
|
45
|
+
|
46
|
+
self.phone = attributes["phone"] if attributes.key?("phone")
|
47
|
+
end
|
48
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
49
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
50
|
+
|
51
|
+
# return true if the model is valid
|
52
|
+
def valid?
|
53
|
+
return false if name.blank?
|
54
|
+
return false if address_line1.blank?
|
55
|
+
return false if state_or_region.blank?
|
56
|
+
return false if country_code.blank?
|
57
|
+
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons.
|
62
|
+
# return Array for invalid properties with the reasons
|
63
|
+
def errors
|
64
|
+
errors = []
|
65
|
+
errors.push('"name" cannot be nil.') if name.blank?
|
66
|
+
errors.push('"address_line1" cannot be nil.') if address_line1.blank?
|
67
|
+
errors.push('"state_or_region" cannot be nil.') if state_or_region.blank?
|
68
|
+
errors.push('"country_code" cannot be nil.') if country_code.blank?
|
69
|
+
|
70
|
+
errors
|
71
|
+
end
|
72
|
+
|
73
|
+
# Format request object in sp-api request format
|
74
|
+
# @return hash for sp-api request format
|
75
|
+
def to_camelize
|
76
|
+
{
|
77
|
+
"name" => name,
|
78
|
+
"addressLine1" => address_line1,
|
79
|
+
"addressLine2" => address_line2,
|
80
|
+
"addressLine3" => address_line3,
|
81
|
+
"city" => city,
|
82
|
+
"districtOrCounty" => district_or_county,
|
83
|
+
"stateOrRegion" => state_or_region,
|
84
|
+
"countryCode" => country_code,
|
85
|
+
"postalCode" => postal_code,
|
86
|
+
"phone" => phone
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module RequestHelpers
|
5
|
+
module OutboundFulfillment
|
6
|
+
class FulfillmentOrderRequest < MuffinMan::RequestHelpers::Base
|
7
|
+
attr_accessor :seller_fulfillment_order_id, :displayable_order_id, :displayable_order_date_time,
|
8
|
+
:displayable_order_comment, :shipping_speed_category, :destination_address, :items,
|
9
|
+
:optional_params
|
10
|
+
|
11
|
+
OPTIONAL_CREATE_FULFILLMENT_ORDER_PARAMS = %w[
|
12
|
+
marketplaceId
|
13
|
+
deliveryWindow
|
14
|
+
fulfillmentAction
|
15
|
+
fulfillmentPolicy
|
16
|
+
codSettings
|
17
|
+
shipFromCountryCode
|
18
|
+
notificationEmails
|
19
|
+
featureConstraints
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
# Initializes the object
|
23
|
+
# @param [String] seller_fulfillment_order_id
|
24
|
+
# @param [String] displayable_order_id
|
25
|
+
# @param [String] displayable_order_date_time
|
26
|
+
# @param [String] displayable_order_comment
|
27
|
+
# @param [String] shipping_speed_category
|
28
|
+
# @param [MuffinMan::RequestHelpers::OutboundFulfillment::Address] destination_address in form of object
|
29
|
+
# @param [MuffinMan::RequestHelpers::OutboundFulfillment::Item] items in the form of list of items objects
|
30
|
+
# @param [Hash] optional_params optional sp-api attributes in the form of hash
|
31
|
+
# rubocop:disable Metrics/ParameterLists
|
32
|
+
def initialize(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time,
|
33
|
+
displayable_order_comment, shipping_speed_category, destination_address, items,
|
34
|
+
optional_params = {})
|
35
|
+
super
|
36
|
+
@seller_fulfillment_order_id = seller_fulfillment_order_id
|
37
|
+
@displayable_order_id = displayable_order_id
|
38
|
+
@displayable_order_date_time = displayable_order_date_time
|
39
|
+
@displayable_order_comment = displayable_order_comment
|
40
|
+
@shipping_speed_category = shipping_speed_category
|
41
|
+
@destination_address = destination_address
|
42
|
+
@items = items
|
43
|
+
@optional_params = optional_params
|
44
|
+
end
|
45
|
+
# rubocop:enable Metrics/ParameterLists
|
46
|
+
|
47
|
+
# Check to see if the all the properties in the model are valid
|
48
|
+
# @return true if the model is valid
|
49
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
50
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
51
|
+
def valid?
|
52
|
+
return false if seller_fulfillment_order_id.blank?
|
53
|
+
return false if displayable_order_id.blank?
|
54
|
+
return false if displayable_order_date_time.blank?
|
55
|
+
return false if displayable_order_comment.blank?
|
56
|
+
return false if shipping_speed_category.blank?
|
57
|
+
return false if destination_address.blank?
|
58
|
+
return false if items.blank?
|
59
|
+
return false if destination_address.present? && !destination_address.valid?
|
60
|
+
return false if items.present? && items.map(&:valid?).include?(false)
|
61
|
+
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons.
|
66
|
+
# @return Array for invalid properties with the
|
67
|
+
def errors
|
68
|
+
errors = []
|
69
|
+
errors.push('"seller_fulfillment_order_id" cannot be nil.') if seller_fulfillment_order_id.blank?
|
70
|
+
errors.push('"displayable_order_id" cannot be nil.') if displayable_order_id.blank?
|
71
|
+
errors.push('"displayable_order_date_time" cannot be nil.') if displayable_order_date_time.blank?
|
72
|
+
errors.push('"displayable_order_comment" cannot be nil.') if displayable_order_comment.blank?
|
73
|
+
errors.push('"shipping_speed_category" cannot be nil.') if shipping_speed_category.blank?
|
74
|
+
errors.push('"destination_address" cannot be nil.') if destination_address.blank?
|
75
|
+
errors.push('"items" cannot be nil.') if items.blank?
|
76
|
+
|
77
|
+
if !destination_address.nil? && !destination_address.valid?
|
78
|
+
errors.push("invalid value for \"destination_address\", #{destination_address.errors}")
|
79
|
+
end
|
80
|
+
|
81
|
+
errors.push('invalid value for "items"') if !items.nil? && items.map(&:valid?).include?(false)
|
82
|
+
|
83
|
+
errors
|
84
|
+
end
|
85
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
86
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
87
|
+
|
88
|
+
# Format request object in sp-api request format
|
89
|
+
# @return hash for sp-api request format
|
90
|
+
def to_camelize
|
91
|
+
{
|
92
|
+
"sellerFulfillmentOrderId" => seller_fulfillment_order_id,
|
93
|
+
"displayableOrderId" => displayable_order_id,
|
94
|
+
"displayableOrderDate" => displayable_order_date_time,
|
95
|
+
"displayableOrderComment" => displayable_order_comment,
|
96
|
+
"shippingSpeedCategory" => shipping_speed_category,
|
97
|
+
"destinationAddress" => destination_address,
|
98
|
+
"items" => items.map(&:to_camelize)
|
99
|
+
}.merge!(optional_params.slice(*OPTIONAL_CREATE_FULFILLMENT_ORDER_PARAMS))
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module RequestHelpers
|
5
|
+
module OutboundFulfillment
|
6
|
+
class FulfillmentPreviewRequest < MuffinMan::RequestHelpers::Base
|
7
|
+
attr_accessor :address, :items, :optional_params
|
8
|
+
|
9
|
+
OPTIONAL_FULFILLMENT_PREVIEW_PARAMS = %w[
|
10
|
+
marketplaceId
|
11
|
+
shippingSpeedCategories
|
12
|
+
includeCODFulfillmentPreview
|
13
|
+
includeDeliveryWindows
|
14
|
+
featureConstraints
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
# Initializes the object
|
18
|
+
# @param [MuffinMan::RequestHelpers::OutboundFulfillment::Address] address in the form of object
|
19
|
+
# @param[MuffinMan::RequestHelpers::OutboundFulfillment::Item] items in the form of list of items objects
|
20
|
+
# @param [Hash] optional_params optional sp-api attributes in the form of hash
|
21
|
+
def initialize(address, items, optional_params = {})
|
22
|
+
super
|
23
|
+
@address = address
|
24
|
+
@items = items
|
25
|
+
@optional_params = optional_params
|
26
|
+
end
|
27
|
+
|
28
|
+
# Check to see if the all the properties in the model are valid
|
29
|
+
# @return true if the model is valid
|
30
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
31
|
+
def valid?
|
32
|
+
return false if address.blank? || !address.is_a?(MuffinMan::RequestHelpers::OutboundFulfillment::Address)
|
33
|
+
return false if items.blank? || !items.is_a?(Array)
|
34
|
+
|
35
|
+
return false if !address.valid? || items.map(&:valid?).include?(false)
|
36
|
+
|
37
|
+
true
|
38
|
+
end
|
39
|
+
|
40
|
+
# Show invalid properties with the reasons.
|
41
|
+
# @return Array for invalid properties with the reasons
|
42
|
+
def errors
|
43
|
+
errors = []
|
44
|
+
errors.push('"address" cannot be nil.') if address.blank?
|
45
|
+
errors.push('"items" cannot be nil.') if items.blank?
|
46
|
+
errors.push("invalid value for \"address\",#{address.errors}") if address.present? && !address.valid?
|
47
|
+
errors.push('invalid value for "items"') if items.present? && items.map(&:valid?).include?(false)
|
48
|
+
|
49
|
+
errors
|
50
|
+
end
|
51
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
52
|
+
|
53
|
+
# Format request object in sp-api request format
|
54
|
+
# @return hash for sp-api request format
|
55
|
+
def to_camelize
|
56
|
+
{
|
57
|
+
"address" => address.to_camelize,
|
58
|
+
"items" => items.map(&:to_camelize)
|
59
|
+
}.merge!(optional_params.slice(*OPTIONAL_FULFILLMENT_PREVIEW_PARAMS))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module RequestHelpers
|
5
|
+
module OutboundFulfillment
|
6
|
+
class Item < MuffinMan::RequestHelpers::Base
|
7
|
+
attr_accessor :seller_sku, :seller_fulfillment_order_item_id, :quantity, :optional_params
|
8
|
+
|
9
|
+
OPTIONAL_ITEM_PARAMS = %w[
|
10
|
+
perUnitDeclaredValue
|
11
|
+
giftMessage
|
12
|
+
displayableComment
|
13
|
+
fulfillmentNetworkSku
|
14
|
+
perUnitDeclaredValue
|
15
|
+
perUnitPrice
|
16
|
+
perUnitTax
|
17
|
+
].freeze
|
18
|
+
|
19
|
+
# Initializes the object
|
20
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
21
|
+
def initialize(attributes = {})
|
22
|
+
super
|
23
|
+
return unless attributes.is_a?(Hash)
|
24
|
+
|
25
|
+
attributes = attributes.with_indifferent_access
|
26
|
+
|
27
|
+
@seller_sku = attributes["seller_sku"] if attributes.key?("seller_sku")
|
28
|
+
|
29
|
+
if attributes.key?("seller_fulfillment_order_item_id")
|
30
|
+
@seller_fulfillment_order_item_id = attributes["seller_fulfillment_order_item_id"]
|
31
|
+
end
|
32
|
+
|
33
|
+
@quantity = attributes["quantity"] if attributes.key?("quantity")
|
34
|
+
|
35
|
+
@optional_params = attributes.slice(*OPTIONAL_ITEM_PARAMS)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check to see if the all the properties in the model are valid
|
39
|
+
# @return true if the model is valid
|
40
|
+
def valid?
|
41
|
+
return false if seller_sku.blank?
|
42
|
+
return false if seller_fulfillment_order_item_id.blank?
|
43
|
+
return false if quantity.blank?
|
44
|
+
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons.
|
49
|
+
# @return Array for invalid properties with the reasons
|
50
|
+
def errors
|
51
|
+
errors = []
|
52
|
+
errors.push('"seller_sku" cannot be nil.') if seller_sku.blank?
|
53
|
+
errors.push('"seller_fulfillment_order_item_id" cannot be nil.') if seller_fulfillment_order_item_id.blank?
|
54
|
+
errors.push('"quantity" cannot be nil.') if quantity.blank?
|
55
|
+
|
56
|
+
errors
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_camelize
|
60
|
+
{
|
61
|
+
"sellerSku" => seller_sku,
|
62
|
+
"sellerFulfillmentOrderItemId" => seller_fulfillment_order_item_id,
|
63
|
+
"quantity" => quantity
|
64
|
+
}.merge!(optional_params.slice(*OPTIONAL_ITEM_PARAMS))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module RequestHelpers
|
5
|
+
module OutboundFulfillment
|
6
|
+
class V20200701
|
7
|
+
def self.address_request(name, address_line1, state_or_region, country_code, optional_params = {})
|
8
|
+
Address.new({
|
9
|
+
"name" => name,
|
10
|
+
"address_line1" => address_line1,
|
11
|
+
"state_or_region" => state_or_region,
|
12
|
+
"country_code" => country_code
|
13
|
+
}.merge(optional_params))
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.item_request(seller_sku, seller_fulfillment_order_item_id, quantity, optional_params = {})
|
17
|
+
Item.new({
|
18
|
+
"seller_sku" => seller_sku,
|
19
|
+
"seller_fulfillment_order_item_id" => seller_fulfillment_order_item_id,
|
20
|
+
"quantity" => quantity
|
21
|
+
}.merge(optional_params))
|
22
|
+
end
|
23
|
+
|
24
|
+
# rubocop:disable Metrics/ParameterLists
|
25
|
+
def self.fulfillment_order_request(seller_fulfillment_order_id, displayable_order_id,
|
26
|
+
displayable_order_date_time,
|
27
|
+
displayable_order_comment, shipping_speed_category,
|
28
|
+
destination_address, items, optional_params = {})
|
29
|
+
FulfillmentOrderRequest.new(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time,
|
30
|
+
displayable_order_comment, shipping_speed_category, destination_address,
|
31
|
+
items, optional_params)
|
32
|
+
end
|
33
|
+
# rubocop:enable Metrics/ParameterLists
|
34
|
+
|
35
|
+
def self.fulfillment_preview_request(address, items, optional_params = {})
|
36
|
+
FulfillmentPreviewRequest.new(address, items, optional_params)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -20,6 +20,8 @@ module MuffinMan
|
|
20
20
|
"fe" => "us-west-2"
|
21
21
|
}.freeze
|
22
22
|
|
23
|
+
UNPROCESSABLE_ENTITY_STATUS_CODE = 422
|
24
|
+
|
23
25
|
def initialize(credentials, sandbox = false)
|
24
26
|
@refresh_token = credentials[:refresh_token]
|
25
27
|
@client_id = credentials[:client_id]
|
@@ -183,6 +185,10 @@ module MuffinMan
|
|
183
185
|
@aws_region
|
184
186
|
end
|
185
187
|
|
188
|
+
def unprocessable_entity(errors)
|
189
|
+
Typhoeus::Response.new(code: UNPROCESSABLE_ENTITY_STATUS_CODE, body: { errors: errors.to_s }.to_json)
|
190
|
+
end
|
191
|
+
|
186
192
|
def sp_api_params(params)
|
187
193
|
params.to_h.transform_keys { |key| key.to_s.split("_").map.with_index { |x, i| i.positive? ? x.capitalize : x }.join }
|
188
194
|
end
|
data/lib/muffin_man/version.rb
CHANGED
data/lib/muffin_man.rb
CHANGED
@@ -14,9 +14,11 @@ require "muffin_man/product_pricing/v0"
|
|
14
14
|
require "muffin_man/listings/v20210801"
|
15
15
|
require "muffin_man/fulfillment_inbound/v0"
|
16
16
|
require "muffin_man/fulfillment_inbound/v1"
|
17
|
+
require "muffin_man/fulfillment_outbound/v20200701"
|
18
|
+
require "muffin_man/fba_inventory/v1"
|
19
|
+
require "muffin_man/request_helpers"
|
17
20
|
require "muffin_man/feeds/v20210630"
|
18
21
|
require "muffin_man/notifications/v1"
|
19
|
-
require "muffin_man/fba_inventory/v1"
|
20
22
|
|
21
23
|
module MuffinMan
|
22
24
|
class Error < StandardError; end
|
data/muffin_man.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muffin_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-11-
|
13
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -116,6 +116,20 @@ dependencies:
|
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: 2.4.4
|
119
|
+
- !ruby/object:Gem::Dependency
|
120
|
+
name: activesupport
|
121
|
+
requirement: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
type: :runtime
|
127
|
+
prerelease: false
|
128
|
+
version_requirements: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
119
133
|
description:
|
120
134
|
email:
|
121
135
|
- gavin@pattern.com
|
@@ -148,6 +162,7 @@ files:
|
|
148
162
|
- lib/muffin_man/finances/v0.rb
|
149
163
|
- lib/muffin_man/fulfillment_inbound/v0.rb
|
150
164
|
- lib/muffin_man/fulfillment_inbound/v1.rb
|
165
|
+
- lib/muffin_man/fulfillment_outbound/v20200701.rb
|
151
166
|
- lib/muffin_man/listings/v20210801.rb
|
152
167
|
- lib/muffin_man/lwa/auth_helper.rb
|
153
168
|
- lib/muffin_man/notifications/v1.rb
|
@@ -158,6 +173,11 @@ files:
|
|
158
173
|
- lib/muffin_man/request_helpers.rb
|
159
174
|
- lib/muffin_man/request_helpers/base.rb
|
160
175
|
- lib/muffin_man/request_helpers/inbound_shipment_plan_request_item.rb
|
176
|
+
- lib/muffin_man/request_helpers/outbound_fulfillment/address.rb
|
177
|
+
- lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb
|
178
|
+
- lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_preview_request.rb
|
179
|
+
- lib/muffin_man/request_helpers/outbound_fulfillment/item.rb
|
180
|
+
- lib/muffin_man/request_helpers/outbound_fulfillment/v20200701.rb
|
161
181
|
- lib/muffin_man/solicitations/v1.rb
|
162
182
|
- lib/muffin_man/sp_api_client.rb
|
163
183
|
- lib/muffin_man/tokens/v20210301.rb
|