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.



13729
13730
13731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13729

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13727
13728
13729
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13727

def value
  @value
end

Class Method Details

.ALLObject



13749
13750
13751
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13749

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



13734
13735
13736
13737
13738
13739
13740
13741
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13734

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



13753
13754
13755
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13753

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



13744
13745
13746
13747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13744

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



13757
13758
13759
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13757

def to_hash
  value
end