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



10024
10025
10026
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10024

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10022
10023
10024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10022

def value
  @value
end

Class Method Details

.adjustmentObject

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



10075
10076
10077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10075

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

.ALLObject



10044
10045
10046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10044

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



10029
10030
10031
10032
10033
10034
10035
10036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10029

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.



10064
10065
10066
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10064

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



10039
10040
10041
10042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10039

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.



10049
10050
10051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10049

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

.marginsObject

The details of any margins added to the item price.



10054
10055
10056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10054

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

.roundingObject

The details of any rounding added to the item.



10069
10070
10071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10069

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

.vatObject

The details of any VAT owed on the item.



10059
10060
10061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10059

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

Instance Method Details

#to_hashObject



10079
10080
10081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10079

def to_hash
  value
end