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.



9503
9504
9505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9503

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9501
9502
9503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9501

def value
  @value
end

Class Method Details

.ALLObject



9523
9524
9525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9523

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



9508
9509
9510
9511
9512
9513
9514
9515
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9508

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



9531
9532
9533
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9531

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



9518
9519
9520
9521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9518

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

.maximumObject



9535
9536
9537
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9535

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

.minimumObject



9527
9528
9529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9527

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

Instance Method Details

#to_hashObject



9539
9540
9541
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9539

def to_hash
  value
end