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.



17623
17624
17625
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17623

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17621
17622
17623
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17621

def value
  @value
end

Class Method Details

.ALLObject



17643
17644
17645
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17643

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



17628
17629
17630
17631
17632
17633
17634
17635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17628

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



17651
17652
17653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17651

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



17638
17639
17640
17641
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17638

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

.maximumObject



17655
17656
17657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17655

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

.minimumObject



17647
17648
17649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17647

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

Instance Method Details

#to_hashObject



17659
17660
17661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17659

def to_hash
  value
end