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.



9733
9734
9735
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9733

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9731
9732
9733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9731

def value
  @value
end

Class Method Details

.ALLObject



9753
9754
9755
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9753

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



9738
9739
9740
9741
9742
9743
9744
9745
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9738

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



9748
9749
9750
9751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9748

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

.maximumObject



9757
9758
9759
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9757

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

.minimumObject



9761
9762
9763
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9761

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

Instance Method Details

#to_hashObject



9765
9766
9767
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9765

def to_hash
  value
end