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.



9849
9850
9851
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9849

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9847
9848
9849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9847

def value
  @value
end

Class Method Details

.adjustmentObject

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



9900
9901
9902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9900

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

.ALLObject



9869
9870
9871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9869

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



9854
9855
9856
9857
9858
9859
9860
9861
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9854

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.



9889
9890
9891
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9889

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



9864
9865
9866
9867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9864

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.



9874
9875
9876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9874

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

.marginsObject

The details of any margins added to the item price.



9879
9880
9881
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9879

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

.roundingObject

The details of any rounding added to the item.



9894
9895
9896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9894

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

.vatObject

The details of any VAT owed on the item.



9884
9885
9886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9884

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

Instance Method Details

#to_hashObject



9904
9905
9906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9904

def to_hash
  value
end