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.



13868
13869
13870
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13868

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13866
13867
13868
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13866

def value
  @value
end

Class Method Details

.ALLObject



13888
13889
13890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13888

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



13873
13874
13875
13876
13877
13878
13879
13880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13873

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



13896
13897
13898
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13896

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



13883
13884
13885
13886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13883

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

.maximumObject



13900
13901
13902
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13900

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

.minimumObject



13892
13893
13894
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13892

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

Instance Method Details

#to_hashObject



13904
13905
13906
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13904

def to_hash
  value
end