Class: Io::Flow::V0::Models::LevyStrategy

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

Returns a new instance of LevyStrategy.



5283
5284
5285
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5283

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5281
5282
5283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5281

def value
  @value
end

Class Method Details

.ALLObject



5303
5304
5305
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5303

def LevyStrategy.ALL
  @@all ||= [LevyStrategy.minimum, LevyStrategy.average, LevyStrategy.maximum]
end

.apply(value) ⇒ Object

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



5288
5289
5290
5291
5292
5293
5294
5295
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5288

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

.averageObject



5311
5312
5313
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5311

def LevyStrategy.average
  @@_average ||= LevyStrategy.new('average')
end

.from_string(value) ⇒ Object

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



5298
5299
5300
5301
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5298

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

.maximumObject



5315
5316
5317
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5315

def LevyStrategy.maximum
  @@_maximum ||= LevyStrategy.new('maximum')
end

.minimumObject



5307
5308
5309
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5307

def LevyStrategy.minimum
  @@_minimum ||= LevyStrategy.new('minimum')
end

Instance Method Details

#to_hashObject



5319
5320
5321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5319

def to_hash
  value
end