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



7278
7279
7280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7278

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7276
7277
7278
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7276

def value
  @value
end

Class Method Details

.ALLObject



7298
7299
7300
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7298

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



7283
7284
7285
7286
7287
7288
7289
7290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7283

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



7302
7303
7304
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7302

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



7293
7294
7295
7296
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7293

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



7306
7307
7308
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7306

def to_hash
  value
end