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.



6785
6786
6787
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6785

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6783
6784
6785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6783

def value
  @value
end

Class Method Details

.ALLObject



6805
6806
6807
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6805

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

.apply(value) ⇒ Object

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



6790
6791
6792
6793
6794
6795
6796
6797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6790

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.



6825
6826
6827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6825

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



6800
6801
6802
6803
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6800

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.



6810
6811
6812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6810

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

.marginsObject

The details of any margins added to the item price.



6815
6816
6817
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6815

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

.roundingObject

The details of any rounding added to the item.



6830
6831
6832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6830

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

.vatObject

The details of any VAT owed on the item.



6820
6821
6822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6820

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

Instance Method Details

#to_hashObject



6834
6835
6836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6834

def to_hash
  value
end