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.



44116
44117
44118
44119
44120
44121
44122
44123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44116

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.



44114
44115
44116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44114

def item_number
  @item_number
end

#leviesObject (readonly)

Returns the value of attribute levies.



44114
44115
44116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44114

def levies
  @levies
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



44114
44115
44116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44114

def line_number
  @line_number
end

#totalObject (readonly)

Returns the value of attribute total.



44114
44115
44116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44114

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44129
44130
44131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44129

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

#to_hashObject



44133
44134
44135
44136
44137
44138
44139
44140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44133

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

#to_jsonObject



44125
44126
44127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44125

def to_json
  JSON.dump(to_hash)
end