Class: MuffinMan::RequestHelpers::OutboundFulfillment::FulfillmentOrderRequest
- Inherits:
-
Base
- Object
- Base
- MuffinMan::RequestHelpers::OutboundFulfillment::FulfillmentOrderRequest
- Defined in:
- lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb
Constant Summary collapse
- OPTIONAL_CREATE_FULFILLMENT_ORDER_PARAMS =
%w[ marketplaceId deliveryWindow fulfillmentAction fulfillmentPolicy codSettings shipFromCountryCode notificationEmails featureConstraints ].freeze
Instance Attribute Summary collapse
-
#destination_address ⇒ Object
Returns the value of attribute destination_address.
-
#displayable_order_comment ⇒ Object
Returns the value of attribute displayable_order_comment.
-
#displayable_order_date_time ⇒ Object
Returns the value of attribute displayable_order_date_time.
-
#displayable_order_id ⇒ Object
Returns the value of attribute displayable_order_id.
-
#items ⇒ Object
Returns the value of attribute items.
-
#optional_params ⇒ Object
Returns the value of attribute optional_params.
-
#seller_fulfillment_order_id ⇒ Object
Returns the value of attribute seller_fulfillment_order_id.
-
#shipping_speed_category ⇒ Object
Returns the value of attribute shipping_speed_category.
Instance Method Summary collapse
-
#errors ⇒ Object
Show invalid properties with the reasons.
-
#initialize(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, optional_params = {}) ⇒ FulfillmentOrderRequest
constructor
Initializes the object.
-
#to_camelize ⇒ Object
Format request object in sp-api request format.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity.
Methods inherited from Base
Constructor Details
#initialize(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, optional_params = {}) ⇒ FulfillmentOrderRequest
Initializes the object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 31 def initialize(seller_fulfillment_order_id, displayable_order_id, displayable_order_date_time, displayable_order_comment, shipping_speed_category, destination_address, items, optional_params = {}) super @seller_fulfillment_order_id = seller_fulfillment_order_id @displayable_order_id = displayable_order_id @displayable_order_date_time = displayable_order_date_time @displayable_order_comment = displayable_order_comment @shipping_speed_category = shipping_speed_category @destination_address = destination_address @items = items @optional_params = optional_params end |
Instance Attribute Details
#destination_address ⇒ Object
Returns the value of attribute destination_address.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def destination_address @destination_address end |
#displayable_order_comment ⇒ Object
Returns the value of attribute displayable_order_comment.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def displayable_order_comment @displayable_order_comment end |
#displayable_order_date_time ⇒ Object
Returns the value of attribute displayable_order_date_time.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def displayable_order_date_time @displayable_order_date_time end |
#displayable_order_id ⇒ Object
Returns the value of attribute displayable_order_id.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def displayable_order_id @displayable_order_id end |
#items ⇒ Object
Returns the value of attribute items.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def items @items end |
#optional_params ⇒ Object
Returns the value of attribute optional_params.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def optional_params @optional_params end |
#seller_fulfillment_order_id ⇒ Object
Returns the value of attribute seller_fulfillment_order_id.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def seller_fulfillment_order_id @seller_fulfillment_order_id end |
#shipping_speed_category ⇒ Object
Returns the value of attribute shipping_speed_category.
7 8 9 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 7 def shipping_speed_category @shipping_speed_category end |
Instance Method Details
#errors ⇒ Object
Show invalid properties with the reasons.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 65 def errors errors = [] errors.push('"seller_fulfillment_order_id" cannot be nil.') if seller_fulfillment_order_id.blank? errors.push('"displayable_order_id" cannot be nil.') if displayable_order_id.blank? errors.push('"displayable_order_date_time" cannot be nil.') if displayable_order_date_time.blank? errors.push('"displayable_order_comment" cannot be nil.') if displayable_order_comment.blank? errors.push('"shipping_speed_category" cannot be nil.') if shipping_speed_category.blank? errors.push('"destination_address" cannot be nil.') if destination_address.blank? errors.push('"items" cannot be nil.') if items.blank? if !destination_address.nil? && !destination_address.valid? errors.push("invalid value for \"destination_address\", #{destination_address.errors}") end errors.push('invalid value for "items"') if !items.nil? && items.map(&:valid?).include?(false) errors end |
#to_camelize ⇒ Object
Format request object in sp-api request format
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 88 def to_camelize { "sellerFulfillmentOrderId" => seller_fulfillment_order_id, "displayableOrderId" => displayable_order_id, "displayableOrderDate" => displayable_order_date_time, "displayableOrderComment" => displayable_order_comment, "shippingSpeedCategory" => shipping_speed_category, "destinationAddress" => destination_address.to_camelize, "items" => items.map(&:to_camelize) }.merge!(optional_params.slice(*OPTIONAL_CREATE_FULFILLMENT_ORDER_PARAMS)) end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/muffin_man/request_helpers/outbound_fulfillment/fulfillment_order_request.rb', line 49 def valid? return false if seller_fulfillment_order_id.blank? return false if displayable_order_id.blank? return false if displayable_order_date_time.blank? return false if displayable_order_comment.blank? return false if shipping_speed_category.blank? return false if destination_address.blank? return false if items.blank? return false if destination_address.present? && !destination_address.valid? return false if items.present? && items.map(&:valid?).include?(false) true end |