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.



6707
6708
6709
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6707

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



6705
6706
6707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6705

def value
  @value
end

Class Method Details

.ALLObject



6727
6728
6729
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6727

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



6712
6713
6714
6715
6716
6717
6718
6719
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6712

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



6731
6732
6733
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6731

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



6722
6723
6724
6725
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6722

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



6735
6736
6737
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6735

def to_hash
  value
end