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.



16264
16265
16266
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16264

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16262
16263
16264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16262

def value
  @value
end

Class Method Details

.ALLObject



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

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



16269
16270
16271
16272
16273
16274
16275
16276
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16269

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



16288
16289
16290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16288

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



16279
16280
16281
16282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16279

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



16292
16293
16294
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16292

def to_hash
  value
end