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.



10472
10473
10474
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10472

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10470
10471
10472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10470

def value
  @value
end

Class Method Details

.adjustmentObject

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



10523
10524
10525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10523

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

.ALLObject



10492
10493
10494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10492

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



10477
10478
10479
10480
10481
10482
10483
10484
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10477

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.



10512
10513
10514
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10512

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



10487
10488
10489
10490
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10487

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.



10497
10498
10499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10497

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

.marginsObject

The details of any margins added to the item price.



10502
10503
10504
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10502

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

.roundingObject

The details of any rounding added to the item.



10517
10518
10519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10517

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

.vatObject

The details of any VAT owed on the item.



10507
10508
10509
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10507

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

Instance Method Details

#to_hashObject



10527
10528
10529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10527

def to_hash
  value
end