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.



8577
8578
8579
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8577

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8575
8576
8577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8575

def value
  @value
end

Class Method Details

.adjustmentObject

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



8628
8629
8630
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8628

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

.ALLObject



8597
8598
8599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8597

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



8582
8583
8584
8585
8586
8587
8588
8589
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8582

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.



8617
8618
8619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8617

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



8592
8593
8594
8595
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8592

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.



8602
8603
8604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8602

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

.marginsObject

The details of any margins added to the item price.



8607
8608
8609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8607

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

.roundingObject

The details of any rounding added to the item.



8622
8623
8624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8622

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

.vatObject

The details of any VAT owed on the item.



8612
8613
8614
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8612

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

Instance Method Details

#to_hashObject



8632
8633
8634
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8632

def to_hash
  value
end