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.



7770
7771
7772
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7770

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7768
7769
7770
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7768

def value
  @value
end

Class Method Details

.ALLObject



7790
7791
7792
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7790

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



7775
7776
7777
7778
7779
7780
7781
7782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7775

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



7794
7795
7796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7794

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



7785
7786
7787
7788
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7785

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



7798
7799
7800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7798

def to_hash
  value
end