Class: Io::Flow::V0::Models::AllocationLineDetail
- Inherits:
-
AllocationDetail
- Object
- AllocationDetail
- Io::Flow::V0::Models::AllocationLineDetail
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#included ⇒ Object
readonly
Returns the value of attribute included.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#not_included ⇒ Object
readonly
Returns the value of attribute not_included.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from AllocationDetail
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationLineDetail
constructor
A new instance of AllocationLineDetail.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from AllocationDetail
Constructor Details
#initialize(incoming = {}) ⇒ AllocationLineDetail
Returns a new instance of AllocationLineDetail.
10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10732 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') @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 |
Instance Attribute Details
#included ⇒ Object (readonly)
Returns the value of attribute included.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def included @included end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def key @key end |
#not_included ⇒ Object (readonly)
Returns the value of attribute not_included.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def not_included @not_included end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def number @number end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def price @price end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def quantity @quantity end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
10730 10731 10732 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10730 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
10749 10750 10751 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10749 def copy(incoming={}) AllocationLineDetail.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10753 def subtype_to_hash { :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 ⇒ Object
10745 10746 10747 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10745 def to_json JSON.dump(to_hash) end |