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.



8884
8885
8886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8884

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8882
8883
8884
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8882

def value
  @value
end

Class Method Details

.ALLObject



8904
8905
8906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8904

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



8889
8890
8891
8892
8893
8894
8895
8896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8889

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



8912
8913
8914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8912

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



8899
8900
8901
8902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8899

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

.maximumObject



8916
8917
8918
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8916

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

.minimumObject



8908
8909
8910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8908

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

Instance Method Details

#to_hashObject



8920
8921
8922
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8920

def to_hash
  value
end