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.



8071
8072
8073
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8071

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8069
8070
8071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8069

def value
  @value
end

Class Method Details

.ALLObject



8091
8092
8093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8091

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



8076
8077
8078
8079
8080
8081
8082
8083
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8076

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



8086
8087
8088
8089
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8086

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

.postObject



8095
8096
8097
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8095

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

Instance Method Details

#to_hashObject



8099
8100
8101
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8099

def to_hash
  value
end