Class: Io::Flow::V0::Models::ReturnForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ReturnForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ReturnForm
constructor
A new instance of ReturnForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ReturnForm
Returns a new instance of ReturnForm.
20961 20962 20963 20964 20965 20966 20967 20968 20969 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20961 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items], 'ReturnForm') @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)) } @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String)) @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))) @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String)) @origin = (x = opts.delete(:origin); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
20959 20960 20961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20959 def destination @destination end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
20959 20960 20961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20959 def items @items end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
20959 20960 20961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20959 def key @key end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
20959 20960 20961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20959 def origin @origin end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
20959 20960 20961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20959 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20975 20976 20977 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20975 def copy(incoming={}) ReturnForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
20979 20980 20981 20982 20983 20984 20985 20986 20987 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20979 def to_hash { :items => items.map { |o| o.to_hash }, :service => service, :destination => destination.nil? ? nil : destination.to_hash, :key => key, :origin => origin.nil? ? nil : origin.to_hash } end |
#to_json ⇒ Object
20971 20972 20973 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20971 def to_json JSON.dump(to_hash) end |