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



10676
10677
10678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10676

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10674
10675
10676
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10674

def value
  @value
end

Class Method Details

.ALLObject



10696
10697
10698
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10696

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



10681
10682
10683
10684
10685
10686
10687
10688
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10681

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



10691
10692
10693
10694
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10691

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

.postObject



10700
10701
10702
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10700

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

Instance Method Details

#to_hashObject



10704
10705
10706
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10704

def to_hash
  value
end