Class: Io::Flow::V0::Models::QuoteForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::QuoteForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#delivered_duties ⇒ Object
readonly
Returns the value of attribute delivered_duties.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#experience ⇒ Object
readonly
Returns the value of attribute experience.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ QuoteForm
constructor
A new instance of QuoteForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ QuoteForm
Returns a new instance of QuoteForm.
28282 28283 28284 28285 28286 28287 28288 28289 28290 28291 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28282 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:destination, :experience, :items], 'QuoteForm') @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @experience = HttpClient::Preconditions.assert_class('experience', opts.delete(:experience), String) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) } @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))) @delivered_duties = (x = opts.delete(:delivered_duties); x.nil? ? nil : HttpClient::Preconditions.assert_class('delivered_duties', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)) }) @direction = (x = opts.delete(:direction); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TierDirection) ? x : ::Io::Flow::V0::Models::TierDirection.apply(x))) end |
Instance Attribute Details
#delivered_duties ⇒ Object (readonly)
Returns the value of attribute delivered_duties.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def delivered_duties @delivered_duties end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def destination @destination end |
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def direction @direction end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def experience @experience end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
28280 28281 28282 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28280 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
28297 28298 28299 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28297 def copy(incoming={}) QuoteForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
28301 28302 28303 28304 28305 28306 28307 28308 28309 28310 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28301 def to_hash { :destination => destination.to_hash, :experience => experience, :items => items.map { |o| o.to_hash }, :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value, :delivered_duties => delivered_duties.nil? ? nil : delivered_duties.map { |o| o.value }, :direction => direction.nil? ? nil : direction.value } end |
#to_json ⇒ Object
28293 28294 28295 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28293 def to_json JSON.dump(to_hash) end |