Class: Io::Flow::V0::Models::Capability

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

Returns a new instance of Capability.



13432
13433
13434
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13432

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13430
13431
13432
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13430

def value
  @value
end

Class Method Details

.ALLObject



13452
13453
13454
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13452

def Capability.ALL
  @@all ||= [Capability.crossdock]
end

.apply(value) ⇒ Object

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



13437
13438
13439
13440
13441
13442
13443
13444
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13437

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

.crossdockObject



13456
13457
13458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13456

def Capability.crossdock
  @@_crossdock ||= Capability.new('crossdock')
end

.from_string(value) ⇒ Object

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



13447
13448
13449
13450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13447

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

Instance Method Details

#to_hashObject



13460
13461
13462
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13460

def to_hash
  value
end