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.



15102
15103
15104
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15102

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15100
15101
15102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15100

def value
  @value
end

Class Method Details

.adjustmentObject

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



15153
15154
15155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15153

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

.ALLObject



15122
15123
15124
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15122

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



15107
15108
15109
15110
15111
15112
15113
15114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15107

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.



15142
15143
15144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15142

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



15117
15118
15119
15120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15117

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.



15127
15128
15129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15127

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

.marginsObject

The details of any margins added to the item price.



15132
15133
15134
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15132

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

.roundingObject

The details of any rounding added to the item.



15147
15148
15149
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15147

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

.vatObject

The details of any VAT owed on the item.



15137
15138
15139
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15137

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

Instance Method Details

#to_hashObject



15157
15158
15159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15157

def to_hash
  value
end