Class: Io::Flow::V0::Models::LevyInclusion

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

Returns a new instance of LevyInclusion.



20485
20486
20487
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20485

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20483
20484
20485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20483

def value
  @value
end

Class Method Details

.ALLObject



20505
20506
20507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20505

def LevyInclusion.ALL
  @@all ||= [LevyInclusion.tax, LevyInclusion.duty]
end

.apply(value) ⇒ Object

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



20490
20491
20492
20493
20494
20495
20496
20497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20490

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

.dutyObject



20513
20514
20515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20513

def LevyInclusion.duty
  @@_duty ||= LevyInclusion.new('duty')
end

.from_string(value) ⇒ Object

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



20500
20501
20502
20503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20500

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

.taxObject



20509
20510
20511
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20509

def LevyInclusion.tax
  @@_tax ||= LevyInclusion.new('tax')
end

Instance Method Details

#to_hashObject



20517
20518
20519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20517

def to_hash
  value
end