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.



10543
10544
10545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10543

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10541
10542
10543
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10541

def value
  @value
end

Class Method Details

.ALLObject



10563
10564
10565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10563

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



10548
10549
10550
10551
10552
10553
10554
10555
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10548

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



10571
10572
10573
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10571

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



10558
10559
10560
10561
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10558

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

.maximumObject



10575
10576
10577
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10575

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

.minimumObject



10567
10568
10569
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10567

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

Instance Method Details

#to_hashObject



10579
10580
10581
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10579

def to_hash
  value
end