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_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#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.
24488 24489 24490 24491 24492 24493 24494 24495 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24488 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))) end |
Instance Attribute Details
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
24486 24487 24488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24486 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
24486 24487 24488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24486 def destination @destination end |
#experience ⇒ Object (readonly)
Returns the value of attribute experience.
24486 24487 24488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24486 def experience @experience end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
24486 24487 24488 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24486 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
24501 24502 24503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24501 def copy(incoming={}) QuoteForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
24505 24506 24507 24508 24509 24510 24511 24512 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24505 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 } end |
#to_json ⇒ Object
24497 24498 24499 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24497 def to_json JSON.dump(to_hash) end |