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.



16286
16287
16288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16286

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16284
16285
16286
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16284

def value
  @value
end

Class Method Details

.ALLObject



16306
16307
16308
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16306

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



16291
16292
16293
16294
16295
16296
16297
16298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16291

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



16310
16311
16312
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16310

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

.descendingObject



16314
16315
16316
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16314

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



16301
16302
16303
16304
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16301

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



16318
16319
16320
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16318

def to_hash
  value
end