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.



17362
17363
17364
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17362

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17360
17361
17362
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17360

def value
  @value
end

Class Method Details

.ALLObject



17382
17383
17384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17382

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



17367
17368
17369
17370
17371
17372
17373
17374
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17367

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



17390
17391
17392
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17390

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



17377
17378
17379
17380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17377

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

.maximumObject



17394
17395
17396
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17394

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

.minimumObject



17386
17387
17388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17386

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

Instance Method Details

#to_hashObject



17398
17399
17400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17398

def to_hash
  value
end