Class: Io::Flow::V0::Models::Return
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Return
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Return
constructor
A new instance of Return.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Return
Returns a new instance of Return.
23470 23471 23472 23473 23474 23475 23476 23477 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23470 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :key, :items, :labels], 'Return') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ReturnLineItem) ? x : ::Io::Flow::V0::Models::ReturnLineItem.new(x)) } @labels = HttpClient::Preconditions.assert_class('labels', opts.delete(:labels), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLabel) ? x : ::Io::Flow::V0::Models::ShippingLabel.new(x)) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
23468 23469 23470 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23468 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
23468 23469 23470 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23468 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
23468 23469 23470 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23468 def key @key end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
23468 23469 23470 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23468 def labels @labels end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
23483 23484 23485 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23483 def copy(incoming={}) Return.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
23487 23488 23489 23490 23491 23492 23493 23494 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23487 def to_hash { :id => id, :key => key, :items => items.map { |o| o.to_hash }, :labels => labels.map { |o| o.to_hash } } end |
#to_json ⇒ Object
23479 23480 23481 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23479 def to_json JSON.dump(to_hash) end |