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.



40897
40898
40899
40900
40901
40902
40903
40904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40897

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.



40895
40896
40897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40895

def item_number
  @item_number
end

#leviesObject (readonly)

Returns the value of attribute levies.



40895
40896
40897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40895

def levies
  @levies
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



40895
40896
40897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40895

def line_number
  @line_number
end

#totalObject (readonly)

Returns the value of attribute total.



40895
40896
40897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40895

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



40910
40911
40912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40910

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

#to_hashObject



40914
40915
40916
40917
40918
40919
40920
40921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40914

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

#to_jsonObject



40906
40907
40908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40906

def to_json
  JSON.dump(to_hash)
end