Class: Io::Flow::V0::Models::DeliveryEstimate
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DeliveryEstimate
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DeliveryEstimate
constructor
A new instance of DeliveryEstimate.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DeliveryEstimate
Returns a new instance of DeliveryEstimate.
8471 8472 8473 8474 8475 8476 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8471 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items, :options], 'DeliveryEstimate') @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)) } = HttpClient::Preconditions.assert_class('options', opts.delete(:options), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::DeliveryOptionEstimate) ? x : ::Io::Flow::V0::Models::DeliveryOptionEstimate.new(x)) } end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
8469 8470 8471 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8469 def items @items end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8469 8470 8471 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8469 def end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
8482 8483 8484 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8482 def copy(incoming={}) DeliveryEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
8486 8487 8488 8489 8490 8491 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8486 def to_hash { :items => items.map { |o| o.to_hash }, :options => .map { |o| o.to_hash } } end |
#to_json ⇒ Object
8478 8479 8480 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8478 def to_json JSON.dump(to_hash) end |