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.



23312
23313
23314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23312

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



23310
23311
23312
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23310

def value
  @value
end

Class Method Details

.adjustmentObject

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



23363
23364
23365
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23363

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

.ALLObject



23332
23333
23334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23332

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



23317
23318
23319
23320
23321
23322
23323
23324
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23317

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.



23352
23353
23354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23352

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



23327
23328
23329
23330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23327

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.



23337
23338
23339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23337

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

.marginsObject

The details of any margins added to the item price.



23342
23343
23344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23342

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

.roundingObject

The details of any rounding added to the item.



23357
23358
23359
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23357

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

.vatObject

The details of any VAT owed on the item.



23347
23348
23349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23347

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

Instance Method Details

#to_hashObject



23367
23368
23369
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23367

def to_hash
  value
end