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.



9080
9081
9082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9080

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9078
9079
9080
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9078

def value
  @value
end

Class Method Details

.ALLObject



9100
9101
9102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9100

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



9085
9086
9087
9088
9089
9090
9091
9092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9085

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



9095
9096
9097
9098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9095

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

.maximumObject



9104
9105
9106
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9104

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

.minimumObject



9108
9109
9110
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9108

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

Instance Method Details

#to_hashObject



9112
9113
9114
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9112

def to_hash
  value
end