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.



14508
14509
14510
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14508

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14506
14507
14508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14506

def value
  @value
end

Class Method Details

.adjustmentObject

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



14559
14560
14561
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14559

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

.ALLObject



14528
14529
14530
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14528

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



14513
14514
14515
14516
14517
14518
14519
14520
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14513

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.



14548
14549
14550
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14548

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



14523
14524
14525
14526
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14523

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.



14533
14534
14535
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14533

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

.marginsObject

The details of any margins added to the item price.



14538
14539
14540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14538

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

.roundingObject

The details of any rounding added to the item.



14553
14554
14555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14553

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

.vatObject

The details of any VAT owed on the item.



14543
14544
14545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14543

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

Instance Method Details

#to_hashObject



14563
14564
14565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14563

def to_hash
  value
end