Class: Io::Flow::V0::Models::AllocationOrderDetail
- Inherits:
-
AllocationDetail
- Object
- AllocationDetail
- Io::Flow::V0::Models::AllocationOrderDetail
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents an order-specific detail such as shipping, insurance, or an order-level discount.
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.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from AllocationDetail
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ AllocationOrderDetail
constructor
A new instance of AllocationOrderDetail.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from AllocationDetail
Constructor Details
#initialize(incoming = {}) ⇒ AllocationOrderDetail
Returns a new instance of AllocationOrderDetail.
11962 11963 11964 11965 11966 11967 11968 11969 11970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11962 def initialize(incoming={}) super(:discriminator => AllocationDetail::Types::ALLOCATION_ORDER_DETAIL) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:key, :total, :included, :not_included], 'AllocationOrderDetail') @key = (x = opts.delete(:key); x.is_a?(::Io::Flow::V0::Models::OrderPriceDetailKey) ? x : ::Io::Flow::V0::Models::OrderPriceDetailKey.apply(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.
11960 11961 11962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11960 def included @included end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11960 11961 11962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11960 def key @key end |
#not_included ⇒ Object (readonly)
Returns the value of attribute not_included.
11960 11961 11962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11960 def not_included @not_included end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
11960 11961 11962 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11960 def total @total end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
11976 11977 11978 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11976 def copy(incoming={}) AllocationOrderDetail.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
11980 11981 11982 11983 11984 11985 11986 11987 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11980 def subtype_to_hash { :key => key.value, :total => total.to_hash, :included => included.map { |o| o.to_hash }, :not_included => not_included.map { |o| o.to_hash } } end |
#to_json ⇒ Object
11972 11973 11974 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11972 def to_json JSON.dump(to_hash) end |