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.



31248
31249
31250
31251
31252
31253
31254
31255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31248

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.



31246
31247
31248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31246

def item_number
  @item_number
end

#leviesObject (readonly)

Returns the value of attribute levies.



31246
31247
31248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31246

def levies
  @levies
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



31246
31247
31248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31246

def line_number
  @line_number
end

#totalObject (readonly)

Returns the value of attribute total.



31246
31247
31248
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31246

def total
  @total
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31261
31262
31263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31261

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

#to_hashObject



31265
31266
31267
31268
31269
31270
31271
31272
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31265

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

#to_jsonObject



31257
31258
31259
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31257

def to_json
  JSON.dump(to_hash)
end