Class: Io::Flow::V0::Models::OrderEstimateForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::OrderEstimateForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Form to get a lightweight estimate of an order.
Instance Attribute Summary collapse
-
#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 = {}) ⇒ OrderEstimateForm
constructor
A new instance of OrderEstimateForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ OrderEstimateForm
Returns a new instance of OrderEstimateForm.
12962 12963 12964 12965 12966 12967 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12962 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:destination, :items], 'OrderEstimateForm') @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @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)) } end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
12960 12961 12962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12960 def destination @destination end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
12960 12961 12962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12960 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
12973 12974 12975 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12973 def copy(incoming={}) OrderEstimateForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
12977 12978 12979 12980 12981 12982 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12977 def to_hash { :destination => destination.to_hash, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
12969 12970 12971 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12969 def to_json JSON.dump(to_hash) end |