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.



22136
22137
22138
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22136

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



22134
22135
22136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22134

def value
  @value
end

Class Method Details

.ALLObject



22156
22157
22158
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22156

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



22141
22142
22143
22144
22145
22146
22147
22148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22141

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



22164
22165
22166
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22164

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



22151
22152
22153
22154
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22151

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

.taxObject



22160
22161
22162
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22160

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

Instance Method Details

#to_hashObject



22168
22169
22170
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22168

def to_hash
  value
end