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.



19354
19355
19356
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19354

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19352
19353
19354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19352

def value
  @value
end

Class Method Details

.ALLObject



19374
19375
19376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19374

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



19359
19360
19361
19362
19363
19364
19365
19366
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19359

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



19378
19379
19380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19378

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

.descendingObject



19382
19383
19384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19382

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



19369
19370
19371
19372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19369

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



19386
19387
19388
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19386

def to_hash
  value
end