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



19307
19308
19309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19307

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19305
19306
19307
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19305

def value
  @value
end

Class Method Details

.adjustmentObject

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



19358
19359
19360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19358

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

.ALLObject



19327
19328
19329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19327

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



19312
19313
19314
19315
19316
19317
19318
19319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19312

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.



19347
19348
19349
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19347

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



19322
19323
19324
19325
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19322

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.



19332
19333
19334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19332

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

.marginsObject

The details of any margins added to the item price.



19337
19338
19339
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19337

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

.roundingObject

The details of any rounding added to the item.



19352
19353
19354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19352

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

.vatObject

The details of any VAT owed on the item.



19342
19343
19344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19342

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

Instance Method Details

#to_hashObject



19362
19363
19364
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19362

def to_hash
  value
end