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.



20527
20528
20529
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20527

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20525
20526
20527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20525

def value
  @value
end

Class Method Details

.ALLObject



20547
20548
20549
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20547

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



20532
20533
20534
20535
20536
20537
20538
20539
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20532

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



20555
20556
20557
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20555

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



20542
20543
20544
20545
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20542

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

.maximumObject



20559
20560
20561
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20559

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

.minimumObject



20551
20552
20553
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20551

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

Instance Method Details

#to_hashObject



20563
20564
20565
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20563

def to_hash
  value
end