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.
31216 31217 31218 31219 31220 31221 31222 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31216 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.
31214 31215 31216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31214 def item_number @item_number end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
31214 31215 31216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31214 def line_number @line_number end |
#quantities ⇒ Object (readonly)
Returns the value of attribute quantities.
31214 31215 31216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31214 def quantities @quantities end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
31228 31229 31230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31228 def copy(incoming={}) FulfillmentItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
31232 31233 31234 31235 31236 31237 31238 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31232 def to_hash { :item_number => item_number, :line_number => line_number, :quantities => quantities.map { |o| o.to_hash } } end |
#to_json ⇒ Object
31224 31225 31226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31224 def to_json JSON.dump(to_hash) end |