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.



9378
9379
9380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9378

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9376
9377
9378
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9376

def value
  @value
end

Class Method Details

.ALLObject



9398
9399
9400
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9398

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



9383
9384
9385
9386
9387
9388
9389
9390
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9383

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



9406
9407
9408
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9406

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



9393
9394
9395
9396
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9393

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

.maximumObject



9410
9411
9412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9410

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

.minimumObject



9402
9403
9404
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9402

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

Instance Method Details

#to_hashObject



9414
9415
9416
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9414

def to_hash
  value
end