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.



9677
9678
9679
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9677

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9675
9676
9677
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9675

def value
  @value
end

Class Method Details

.ALLObject



9697
9698
9699
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9697

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



9682
9683
9684
9685
9686
9687
9688
9689
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9682

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



9701
9702
9703
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9701

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



9692
9693
9694
9695
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9692

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



9705
9706
9707
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9705

def to_hash
  value
end