Class: Io::Flow::V0::Models::WithholdingDeductionType

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

Returns a new instance of WithholdingDeductionType.



28506
28507
28508
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28506

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



28504
28505
28506
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28504

def value
  @value
end

Class Method Details

.ALLObject



28526
28527
28528
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28526

def WithholdingDeductionType.ALL
  @@all ||= [WithholdingDeductionType.tax, WithholdingDeductionType.duty, WithholdingDeductionType.freight, WithholdingDeductionType.insurance]
end

.apply(value) ⇒ Object

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



28511
28512
28513
28514
28515
28516
28517
28518
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28511

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

.dutyObject



28534
28535
28536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28534

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

.freightObject



28538
28539
28540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28538

def WithholdingDeductionType.freight
  @@_freight ||= WithholdingDeductionType.new('freight')
end

.from_string(value) ⇒ Object

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



28521
28522
28523
28524
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28521

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

.insuranceObject



28542
28543
28544
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28542

def WithholdingDeductionType.insurance
  @@_insurance ||= WithholdingDeductionType.new('insurance')
end

.taxObject



28530
28531
28532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28530

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

Instance Method Details

#to_hashObject



28546
28547
28548
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28546

def to_hash
  value
end