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.



22175
22176
22177
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22175

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



22173
22174
22175
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22173

def value
  @value
end

Class Method Details

.adjustmentObject

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



22226
22227
22228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22226

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

.ALLObject



22195
22196
22197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22195

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



22180
22181
22182
22183
22184
22185
22186
22187
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22180

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.



22215
22216
22217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22215

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



22190
22191
22192
22193
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22190

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.



22200
22201
22202
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22200

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

.marginsObject

The details of any margins added to the item price.



22205
22206
22207
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22205

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

.roundingObject

The details of any rounding added to the item.



22220
22221
22222
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22220

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

.vatObject

The details of any VAT owed on the item.



22210
22211
22212
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22210

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

Instance Method Details

#to_hashObject



22230
22231
22232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22230

def to_hash
  value
end