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.



18442
18443
18444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18442

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18440
18441
18442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18440

def value
  @value
end

Class Method Details

.adjustmentObject

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



18493
18494
18495
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18493

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

.ALLObject



18462
18463
18464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18462

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



18447
18448
18449
18450
18451
18452
18453
18454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18447

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.



18482
18483
18484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18482

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



18457
18458
18459
18460
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18457

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.



18467
18468
18469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18467

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

.marginsObject

The details of any margins added to the item price.



18472
18473
18474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18472

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

.roundingObject

The details of any rounding added to the item.



18487
18488
18489
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18487

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

.vatObject

The details of any VAT owed on the item.



18477
18478
18479
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18477

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

Instance Method Details

#to_hashObject



18497
18498
18499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18497

def to_hash
  value
end