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.



18098
18099
18100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18098

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18096
18097
18098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18096

def value
  @value
end

Class Method Details

.adjustmentObject

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



18149
18150
18151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18149

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

.ALLObject



18118
18119
18120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18118

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



18103
18104
18105
18106
18107
18108
18109
18110
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18103

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.



18138
18139
18140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18138

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



18113
18114
18115
18116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18113

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.



18123
18124
18125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18123

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

.marginsObject

The details of any margins added to the item price.



18128
18129
18130
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18128

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

.roundingObject

The details of any rounding added to the item.



18143
18144
18145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18143

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

.vatObject

The details of any VAT owed on the item.



18133
18134
18135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18133

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

Instance Method Details

#to_hashObject



18153
18154
18155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18153

def to_hash
  value
end