class Io::Flow::V0::Models::OrderEstimateForm

Form to get a lightweight estimate of an order.

Attributes

destination[R]
items[R]
selections[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 51835
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:items], 'OrderEstimateForm')
  @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)) }
  @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x)))
  @selections = (x = opts.delete(:selections); x.nil? ? nil : HttpClient::Preconditions.assert_class('selections', x, Array).map { |v| HttpClient::Preconditions.assert_class('selections', v, String) })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 51847
def copy(incoming={})
  OrderEstimateForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 51851
def to_hash
  {
    :items => items.map { |o| o.to_hash },
    :destination => destination.nil? ? nil : destination.to_hash,
    :selections => selections.nil? ? nil : selections
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 51843
def to_json
  JSON.dump(to_hash)
end