Class: AdyenApIs::HttpMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/adyen_ap_is/models/http_method.rb

Overview

The HTTP method to use for the request Adyen makes on your behalf to the third party.

Constant Summary collapse

HTTP_METHOD =
[
  # TODO: Write general description for POST
  POST = 'post'.freeze,

  # TODO: Write general description for PUT
  PUT = 'put'.freeze,

  # TODO: Write general description for PATCH
  PATCH = 'patch'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = POST) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/adyen_ap_is/models/http_method.rb', line 27

def self.from_value(value, default_value = POST)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'post' then POST
  when 'put' then PUT
  when 'patch' then PATCH
  else
    default_value
  end
end

.validate(value) ⇒ Object



21
22
23
24
25
# File 'lib/adyen_ap_is/models/http_method.rb', line 21

def self.validate(value)
  return false if value.nil?

  HTTP_METHOD.include?(value)
end