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.



4981
4982
4983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4981

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4979
4980
4981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4979

def value
  @value
end

Class Method Details

.ALLObject



5001
5002
5003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5001

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

.apply(value) ⇒ Object

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



4986
4987
4988
4989
4990
4991
4992
4993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4986

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.



5007
5008
5009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5007

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



4996
4997
4998
4999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4996

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

.tax_deminimisObject

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



5013
5014
5015
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5013

def AdjustmentReasonKey.tax_deminimis
  @@_tax_deminimis ||= AdjustmentReasonKey.new('tax_deminimis')
end

Instance Method Details

#to_hashObject



5017
5018
5019
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5017

def to_hash
  value
end