Class: Io::Flow::V0::Models::FulfillmentItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::FulfillmentItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Used to track and manage the fulfillment of quantities of a sku
Instance Attribute Summary collapse
-
#item_number ⇒ Object
readonly
Returns the value of attribute item_number.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#quantities ⇒ Object
readonly
Returns the value of attribute quantities.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ FulfillmentItem
constructor
A new instance of FulfillmentItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ FulfillmentItem
Returns a new instance of FulfillmentItem.
44084 44085 44086 44087 44088 44089 44090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44084 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:item_number, :line_number, :quantities], 'FulfillmentItem') @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String) @line_number = HttpClient::Preconditions.assert_class('line_number', opts.delete(:line_number), Integer) @quantities = HttpClient::Preconditions.assert_class('quantities', opts.delete(:quantities), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FulfillmentItemQuantity) ? x : ::Io::Flow::V0::Models::FulfillmentItemQuantity.new(x)) } end |
Instance Attribute Details
#item_number ⇒ Object (readonly)
Returns the value of attribute item_number.
44082 44083 44084 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44082 def item_number @item_number end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
44082 44083 44084 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44082 def line_number @line_number end |
#quantities ⇒ Object (readonly)
Returns the value of attribute quantities.
44082 44083 44084 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44082 def quantities @quantities end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
44096 44097 44098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44096 def copy(incoming={}) FulfillmentItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
44100 44101 44102 44103 44104 44105 44106 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44100 def to_hash { :item_number => item_number, :line_number => line_number, :quantities => quantities.map { |o| o.to_hash } } end |
#to_json ⇒ Object
44092 44093 44094 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44092 def to_json JSON.dump(to_hash) end |