Class: Io::Flow::V0::Models::DeliveryOptionForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryOptionForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a way to fulfill a delivery, including an estimates for the date range and cost
Instance Attribute Summary collapse
-
#delivery ⇒ Object
readonly
Returns the value of attribute delivery.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryOptionForm
constructor
A new instance of DeliveryOptionForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryOptionForm
Returns a new instance of DeliveryOptionForm.
39076 39077 39078 39079 39080 39081 39082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39076 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:delivery, :items, :destination], 'DeliveryOptionForm') @delivery = HttpClient::Preconditions.assert_class('delivery', opts.delete(:delivery), String) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::QuoteLineItemForm) ? x : ::Io::Flow::V0::Models::QuoteLineItemForm.new(x)) } @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) end |
Instance Attribute Details
#delivery ⇒ Object (readonly)
Returns the value of attribute delivery.
39074 39075 39076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39074 def delivery @delivery end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
39074 39075 39076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39074 def destination @destination end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
39074 39075 39076 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39074 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
39088 39089 39090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39088 def copy(incoming={}) DeliveryOptionForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
39092 39093 39094 39095 39096 39097 39098 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39092 def to_hash { :delivery => delivery, :items => items.map { |o| o.to_hash }, :destination => destination.to_hash } end |
#to_json ⇒ Object
39084 39085 39086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 39084 def to_json JSON.dump(to_hash) end |