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.



11637
11638
11639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11637

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11635
11636
11637
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11635

def value
  @value
end

Class Method Details

.adjustmentObject

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



11688
11689
11690
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11688

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

.ALLObject



11657
11658
11659
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11657

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



11642
11643
11644
11645
11646
11647
11648
11649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11642

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.



11677
11678
11679
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11677

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



11652
11653
11654
11655
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11652

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.



11662
11663
11664
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11662

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

.marginsObject

The details of any margins added to the item price.



11667
11668
11669
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11667

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

.roundingObject

The details of any rounding added to the item.



11682
11683
11684
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11682

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

.vatObject

The details of any VAT owed on the item.



11672
11673
11674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11672

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

Instance Method Details

#to_hashObject



11692
11693
11694
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 11692

def to_hash
  value
end