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.
30369 30370 30371 30372 30373 30374 30375 30376 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30369 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.
30367 30368 30369 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30367 def id @id end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
30367 30368 30369 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30367 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
30367 30368 30369 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30367 def key @key end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
30367 30368 30369 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30367 def labels @labels end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30382 30383 30384 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30382 def copy(incoming={}) Return.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30386 30387 30388 30389 30390 30391 30392 30393 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30386 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
30378 30379 30380 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30378 def to_json JSON.dump(to_hash) end |