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.
9867 9868 9869 9870 9871 9872 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9867 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.
9865 9866 9867 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9865 def items @items end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9865 9866 9867 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9865 def end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
9878 9879 9880 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9878 def copy(incoming={}) DeliveryEstimate.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
9882 9883 9884 9885 9886 9887 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9882 def to_hash { :items => items.map { |o| o.to_hash }, :options => .map { |o| o.to_hash } } end |
#to_json ⇒ Object
9874 9875 9876 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9874 def to_json JSON.dump(to_hash) end |