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.



12098
12099
12100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12098

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12096
12097
12098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12096

def value
  @value
end

Class Method Details

.ALLObject



12118
12119
12120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12118

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



12103
12104
12105
12106
12107
12108
12109
12110
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12103

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



12122
12123
12124
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12122

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



12113
12114
12115
12116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12113

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



12126
12127
12128
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12126

def to_hash
  value
end