Class: Io::Flow::V0::Models::AdjustmentReasonKey

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) ⇒ AdjustmentReasonKey

Returns a new instance of AdjustmentReasonKey.



6521
6522
6523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6521

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6519
6520
6521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6519

def value
  @value
end

Class Method Details

.ALLObject



6541
6542
6543
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6541

def AdjustmentReasonKey.ALL
  @@all ||= [AdjustmentReasonKey.duty_deminimis, AdjustmentReasonKey.vat_deminimis]
end

.apply(value) ⇒ Object

Returns the instance of AdjustmentReasonKey for this value, creating a new instance for an unknown value



6526
6527
6528
6529
6530
6531
6532
6533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6526

def AdjustmentReasonKey.apply(value)
  if value.instance_of?(AdjustmentReasonKey)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || AdjustmentReasonKey.new(value))
  end
end

.duty_deminimisObject

If the duty de minimis value has not been met, an adjustment may be made to offset any previously calculated duty.



6547
6548
6549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6547

def AdjustmentReasonKey.duty_deminimis
  @@_duty_deminimis ||= AdjustmentReasonKey.new('duty_deminimis')
end

.from_string(value) ⇒ Object

Returns the instance of AdjustmentReasonKey for this value, or nil if not found



6536
6537
6538
6539
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6536

def AdjustmentReasonKey.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  AdjustmentReasonKey.ALL.find { |v| v.value == value }
end

.vat_deminimisObject

If the VAT de minimis value has not been met, an adjustment may be made to offset any previously calculated VAT.



6553
6554
6555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6553

def AdjustmentReasonKey.vat_deminimis
  @@_vat_deminimis ||= AdjustmentReasonKey.new('vat_deminimis')
end

Instance Method Details

#to_hashObject



6557
6558
6559
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6557

def to_hash
  value
end