Class: Io::Flow::V0::Models::Aggregate

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) ⇒ Aggregate

Returns a new instance of Aggregate.



12972
12973
12974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12972

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12970
12971
12972
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12970

def value
  @value
end

Class Method Details

.ALLObject



12992
12993
12994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12992

def Aggregate.ALL
  @@all ||= [Aggregate.maximum, Aggregate.minimum]
end

.apply(value) ⇒ Object

Returns the instance of Aggregate for this value, creating a new instance for an unknown value



12977
12978
12979
12980
12981
12982
12983
12984
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12977

def Aggregate.apply(value)
  if value.instance_of?(Aggregate)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || Aggregate.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of Aggregate for this value, or nil if not found



12987
12988
12989
12990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12987

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

.maximumObject



12996
12997
12998
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12996

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

.minimumObject



13000
13001
13002
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13000

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

Instance Method Details

#to_hashObject



13004
13005
13006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13004

def to_hash
  value
end