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.



8841
8842
8843
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8841

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8839
8840
8841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8839

def value
  @value
end

Class Method Details

.ALLObject



8861
8862
8863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8861

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



8846
8847
8848
8849
8850
8851
8852
8853
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8846

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



8869
8870
8871
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8869

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



8856
8857
8858
8859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8856

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

.maximumObject



8873
8874
8875
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8873

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

.minimumObject



8865
8866
8867
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8865

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

Instance Method Details

#to_hashObject



8877
8878
8879
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8877

def to_hash
  value
end