Class: Io::Flow::V0::Models::PriceDetailKey

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ PriceDetailKey

Returns a new instance of PriceDetailKey.



25357
25358
25359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25357

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



25355
25356
25357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25355

def value
  @value
end

Class Method Details

.adjustmentObject

The details of any price adjustments due to sales margins. A negative value indicates a discount.



25408
25409
25410
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25408

def PriceDetailKey.adjustment
  @@_adjustment ||= PriceDetailKey.new('adjustment')
end

.ALLObject



25377
25378
25379
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25377

def PriceDetailKey.ALL
  @@all ||= [PriceDetailKey.item_price, PriceDetailKey.margins, PriceDetailKey.vat, PriceDetailKey.duty, PriceDetailKey.rounding, PriceDetailKey.adjustment]
end

.apply(value) ⇒ Object

Returns the instance of PriceDetailKey for this value, creating a new instance for an unknown value



25362
25363
25364
25365
25366
25367
25368
25369
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25362

def PriceDetailKey.apply(value)
  if value.instance_of?(PriceDetailKey)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || PriceDetailKey.new(value))
  end
end

.dutyObject

The details of any duties owed on the item.



25397
25398
25399
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25397

def PriceDetailKey.duty
  @@_duty ||= PriceDetailKey.new('duty')
end

.from_string(value) ⇒ Object

Returns the instance of PriceDetailKey for this value, or nil if not found



25372
25373
25374
25375
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25372

def PriceDetailKey.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  PriceDetailKey.ALL.find { |v| v.value == value }
end

.item_priceObject

The details of the item price.



25382
25383
25384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25382

def PriceDetailKey.item_price
  @@_item_price ||= PriceDetailKey.new('item_price')
end

.marginsObject

The details of any margins added to the item price.



25387
25388
25389
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25387

def PriceDetailKey.margins
  @@_margins ||= PriceDetailKey.new('margins')
end

.roundingObject

The details of any rounding added to the item.



25402
25403
25404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25402

def PriceDetailKey.rounding
  @@_rounding ||= PriceDetailKey.new('rounding')
end

.vatObject

The details of any VAT owed on the item.



25392
25393
25394
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25392

def PriceDetailKey.vat
  @@_vat ||= PriceDetailKey.new('vat')
end

Instance Method Details

#to_hashObject



25412
25413
25414
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25412

def to_hash
  value
end