class Io::Flow::V0::Models::AllocationLineDetail
Attributes
id[R]
included[R]
key[R]
not_included[R]
number[R]
price[R]
quantity[R]
total[R]
Public Class Methods
new(incoming={})
click to toggle source
Calls superclass method
Io::Flow::V0::Models::AllocationDetail::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 30168 def initialize(incoming={}) super(:discriminator => AllocationDetail::Types::ALLOCATION_LINE_DETAIL) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :quantity, :key, :price, :total, :included, :not_included], 'AllocationLineDetail') @id = (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, String)) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailKey.apply(x)) @price = (x = opts.delete(:price); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @total = (x = opts.delete(:total); x.is_a?(::Io::Flow::V0::Models::PriceWithBase) ? x : ::Io::Flow::V0::Models::PriceWithBase.new(x)) @included = HttpClient::Preconditions.assert_class('included', opts.delete(:included), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AllocationComponent) ? x : ::Io::Flow::V0::Models::AllocationComponent.from_json(x)) } @not_included = HttpClient::Preconditions.assert_class('not_included', opts.delete(:not_included), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AllocationComponent) ? x : ::Io::Flow::V0::Models::AllocationComponent.from_json(x)) } end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30186 def copy(incoming={}) AllocationLineDetail.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30190 def subtype_to_hash { :id => id, :number => number, :quantity => quantity, :key => key.value, :price => price.to_hash, :total => total.to_hash, :included => included.map { |o| o.to_hash }, :not_included => not_included.map { |o| o.to_hash } } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 30182 def to_json JSON.dump(to_hash) end