Class: Io::Flow::V0::Models::SortDirection

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

Returns a new instance of SortDirection.



24704
24705
24706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24704

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



24702
24703
24704
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24702

def value
  @value
end

Class Method Details

.ALLObject



24724
24725
24726
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24724

def SortDirection.ALL
  @@all ||= [SortDirection.ascending, SortDirection.descending]
end

.apply(value) ⇒ Object

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



24709
24710
24711
24712
24713
24714
24715
24716
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24709

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

.ascendingObject



24728
24729
24730
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24728

def SortDirection.ascending
  @@_ascending ||= SortDirection.new('ascending')
end

.descendingObject



24732
24733
24734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24732

def SortDirection.descending
  @@_descending ||= SortDirection.new('descending')
end

.from_string(value) ⇒ Object

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



24719
24720
24721
24722
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24719

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

Instance Method Details

#to_hashObject



24736
24737
24738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24736

def to_hash
  value
end