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.



19046
19047
19048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19046

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19044
19045
19046
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19044

def value
  @value
end

Class Method Details

.adjustmentObject

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



19097
19098
19099
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19097

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

.ALLObject



19066
19067
19068
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19066

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



19051
19052
19053
19054
19055
19056
19057
19058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19051

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.



19086
19087
19088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19086

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



19061
19062
19063
19064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19061

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.



19071
19072
19073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19071

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

.marginsObject

The details of any margins added to the item price.



19076
19077
19078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19076

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

.roundingObject

The details of any rounding added to the item.



19091
19092
19093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19091

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

.vatObject

The details of any VAT owed on the item.



19081
19082
19083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19081

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

Instance Method Details

#to_hashObject



19101
19102
19103
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19101

def to_hash
  value
end