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.



9059
9060
9061
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9059

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9057
9058
9059
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9057

def value
  @value
end

Class Method Details

.ALLObject



9079
9080
9081
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9079

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



9064
9065
9066
9067
9068
9069
9070
9071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9064

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



9087
9088
9089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9087

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



9074
9075
9076
9077
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9074

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

.maximumObject



9091
9092
9093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9091

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

.minimumObject



9083
9084
9085
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9083

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

Instance Method Details

#to_hashObject



9095
9096
9097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9095

def to_hash
  value
end