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.
18929 18930 18931 18932 18933 18934 18935 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18929 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.
18927 18928 18929 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18927 def item_number @item_number end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
18927 18928 18929 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18927 def line_number @line_number end |
#quantities ⇒ Object (readonly)
Returns the value of attribute quantities.
18927 18928 18929 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18927 def quantities @quantities end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
18941 18942 18943 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18941 def copy(incoming={}) FulfillmentItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
18945 18946 18947 18948 18949 18950 18951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18945 def to_hash { :item_number => item_number, :line_number => line_number, :quantities => quantities.map { |o| o.to_hash } } end |
#to_json ⇒ Object
18937 18938 18939 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18937 def to_json JSON.dump(to_hash) end |