Class: Io::Flow::V0::Models::IncludedLevyKey

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

Returns a new instance of IncludedLevyKey.



16245
16246
16247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16245

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16243
16244
16245
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16243

def value
  @value
end

Class Method Details

.ALLObject



16265
16266
16267
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16265

def IncludedLevyKey.ALL
  @@all ||= [IncludedLevyKey.duty, IncludedLevyKey.vat, IncludedLevyKey.vat_and_duty, IncludedLevyKey.none]
end

.apply(value) ⇒ Object

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



16250
16251
16252
16253
16254
16255
16256
16257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16250

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

.dutyObject



16269
16270
16271
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16269

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

.from_string(value) ⇒ Object

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



16260
16261
16262
16263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16260

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

.noneObject



16281
16282
16283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16281

def IncludedLevyKey.none
  @@_none ||= IncludedLevyKey.new('none')
end

.vatObject



16273
16274
16275
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16273

def IncludedLevyKey.vat
  @@_vat ||= IncludedLevyKey.new('vat')
end

.vat_and_dutyObject



16277
16278
16279
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16277

def IncludedLevyKey.vat_and_duty
  @@_vat_and_duty ||= IncludedLevyKey.new('vat_and_duty')
end

Instance Method Details

#to_hashObject



16285
16286
16287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16285

def to_hash
  value
end