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.



7062
7063
7064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7062

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7060
7061
7062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7060

def value
  @value
end

Class Method Details

.ALLObject



7082
7083
7084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7082

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



7067
7068
7069
7070
7071
7072
7073
7074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7067

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



7086
7087
7088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7086

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



7077
7078
7079
7080
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7077

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



7090
7091
7092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7090

def to_hash
  value
end