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.



7815
7816
7817
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7815

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7813
7814
7815
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7813

def value
  @value
end

Class Method Details

.ALLObject



7835
7836
7837
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7835

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



7820
7821
7822
7823
7824
7825
7826
7827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7820

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



7839
7840
7841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7839

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



7830
7831
7832
7833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7830

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



7843
7844
7845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7843

def to_hash
  value
end