class Io::Flow::V0::Models::OrderWithDiscountsForm

Attributes

discounts[R]
order[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54580
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:order], 'OrderWithDiscountsForm')
  @order = (x = opts.delete(:order); x.is_a?(::Io::Flow::V0::Models::OrderForm) ? x : ::Io::Flow::V0::Models::OrderForm.new(x))
  @discounts = HttpClient::Preconditions.assert_class('discounts', (x = opts.delete(:discounts); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('discounts', v, String) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54591
def copy(incoming={})
  OrderWithDiscountsForm.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 54595
def to_hash
  {
    :order => order.to_hash,
    :discounts => discounts
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 54587
def to_json
  JSON.dump(to_hash)
end