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.



8501
8502
8503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8501

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8499
8500
8501
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8499

def value
  @value
end

Class Method Details

.ALLObject



8521
8522
8523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8521

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



8506
8507
8508
8509
8510
8511
8512
8513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8506

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



8525
8526
8527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8525

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



8516
8517
8518
8519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8516

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



8529
8530
8531
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8529

def to_hash
  value
end