Class: Io::Flow::V0::Models::TaxabilityType

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

Returns a new instance of TaxabilityType.



20029
20030
20031
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20029

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20027
20028
20029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20027

def value
  @value
end

Class Method Details

.ALLObject



20049
20050
20051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20049

def TaxabilityType.ALL
  @@all ||= [TaxabilityType.tax_rule]
end

.apply(value) ⇒ Object

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



20034
20035
20036
20037
20038
20039
20040
20041
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20034

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

.from_string(value) ⇒ Object

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



20044
20045
20046
20047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20044

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

.tax_ruleObject

Rule indicating how taxes should be applied. Acceptable values are defined by the ‘taxability_value’ enum.



20055
20056
20057
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20055

def TaxabilityType.tax_rule
  @@_tax_rule ||= TaxabilityType.new('tax_rule')
end

Instance Method Details

#to_hashObject



20059
20060
20061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20059

def to_hash
  value
end