Class: Io::Flow::V0::Models::Method

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) ⇒ Method

Returns a new instance of Method.



8633
8634
8635
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8633

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8631
8632
8633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8631

def value
  @value
end

Class Method Details

.ALLObject



8653
8654
8655
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8653

def Method.ALL
  @@all ||= [Method.post]
end

.apply(value) ⇒ Object

Returns the instance of Method for this value, creating a new instance for an unknown value



8638
8639
8640
8641
8642
8643
8644
8645
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8638

def Method.apply(value)
  if value.instance_of?(Method)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || Method.new(value))
  end
end

.from_string(value) ⇒ Object

Returns the instance of Method for this value, or nil if not found



8648
8649
8650
8651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8648

def Method.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  Method.ALL.find { |v| v.value == value }
end

.postObject



8657
8658
8659
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8657

def Method.post
  @@_post ||= Method.new('post')
end

Instance Method Details

#to_hashObject



8661
8662
8663
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8661

def to_hash
  value
end