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.



13062
13063
13064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13062

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13060
13061
13062
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13060

def value
  @value
end

Class Method Details

.ALLObject



13082
13083
13084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13082

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



13067
13068
13069
13070
13071
13072
13073
13074
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13067

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



13086
13087
13088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13086

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



13077
13078
13079
13080
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13077

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



13090
13091
13092
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13090

def to_hash
  value
end