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.



10670
10671
10672
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10670

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10668
10669
10670
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10668

def value
  @value
end

Class Method Details

.ALLObject



10690
10691
10692
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10690

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



10675
10676
10677
10678
10679
10680
10681
10682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10675

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



10698
10699
10700
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10698

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



10685
10686
10687
10688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10685

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

.maximumObject



10702
10703
10704
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10702

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

.minimumObject



10694
10695
10696
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10694

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

Instance Method Details

#to_hashObject



10706
10707
10708
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10706

def to_hash
  value
end