Class: Io::Flow::V0::Models::FulfillmentItemAllocationDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Details about how prices were allocated to a fulfillment; use for reporting the value or net value of a line

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ FulfillmentItemAllocationDetails

Returns a new instance of FulfillmentItemAllocationDetails.



34142
34143
34144
34145
34146
34147
34148
34149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34142

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item_number, :line_number, :levies, :total], 'FulfillmentItemAllocationDetails')
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @line_number = HttpClient::Preconditions.assert_class('line_number', opts.delete(:line_number), Integer)
  @levies = (x = opts.delete(:levies); 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))
end

Instance Attribute Details

#item_numberObject (readonly)

Returns the value of attribute item_number.



34140
34141
34142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34140

def item_number
  @item_number
end

#leviesObject (readonly)

Returns the value of attribute levies.



34140
34141
34142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34140

def levies
  @levies
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



34140
34141
34142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34140

def line_number
  @line_number
end

#totalObject (readonly)

Returns the value of attribute total.



34140
34141
34142
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34140

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34155
34156
34157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34155

def copy(incoming={})
  FulfillmentItemAllocationDetails.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



34159
34160
34161
34162
34163
34164
34165
34166
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34159

def to_hash
  {
    :item_number => item_number,
    :line_number => line_number,
    :levies => levies.to_hash,
    :total => total.to_hash
  }
end

#to_jsonObject



34151
34152
34153
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34151

def to_json
  JSON.dump(to_hash)
end