Class: Io::Flow::V0::Models::Fulfillment
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Fulfillment
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Used to track and manage the fulfillment of an order.
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Fulfillment
constructor
A new instance of Fulfillment.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Fulfillment
Returns a new instance of Fulfillment.
40741 40742 40743 40744 40745 40746 40747 40748 40749 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40741 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:organization, :key, :number, :items], 'Fulfillment') @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::FulfillmentItem) ? x : ::Io::Flow::V0::Models::FulfillmentItem.new(x)) } @center = (x = opts.delete(:center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterSummary) ? x : ::Io::Flow::V0::Models::CenterSummary.new(x))) end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
40739 40740 40741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40739 def center @center end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
40739 40740 40741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40739 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
40739 40740 40741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40739 def key @key end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
40739 40740 40741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40739 def number @number end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
40739 40740 40741 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40739 def organization @organization end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
40755 40756 40757 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40755 def copy(incoming={}) Fulfillment.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
40759 40760 40761 40762 40763 40764 40765 40766 40767 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40759 def to_hash { :organization => organization, :key => key, :number => number, :items => items.map { |o| o.to_hash }, :center => center.nil? ? nil : center.to_hash } end |
#to_json ⇒ Object
40751 40752 40753 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40751 def to_json JSON.dump(to_hash) end |