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.



9431
9432
9433
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9431

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9429
9430
9431
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9429

def value
  @value
end

Class Method Details

.ALLObject



9451
9452
9453
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9451

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



9436
9437
9438
9439
9440
9441
9442
9443
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9436

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



9459
9460
9461
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9459

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



9446
9447
9448
9449
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9446

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

.maximumObject



9463
9464
9465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9463

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

.minimumObject



9455
9456
9457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9455

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

Instance Method Details

#to_hashObject



9467
9468
9469
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9467

def to_hash
  value
end