Class: PaypalServerSdk::LinkHttpMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/link_http_method.rb

Overview

The HTTP method required to make the related call.

Constant Summary collapse

[
  # The HTTP GET method.
  GET = 'GET'.freeze,

  # The HTTP POST method.
  POST = 'POST'.freeze,

  # The HTTP PUT method.
  PUT = 'PUT'.freeze,

  # The HTTP DELETE method.
  DELETE = 'DELETE'.freeze,

  # The HTTP HEAD method.
  HEAD = 'HEAD'.freeze,

  # The HTTP CONNECT method.
  CONNECT = 'CONNECT'.freeze,

  # The HTTP OPTIONS method.
  OPTIONS = 'OPTIONS'.freeze,

  # The HTTP PATCH method.
  PATCH = 'PATCH'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = GET) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/paypal_server_sdk/models/link_http_method.rb', line 41

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

  str = value.to_s.strip

  case str.downcase
  when 'get' then GET
  when 'post' then POST
  when 'put' then PUT
  when 'delete' then DELETE
  when 'head' then HEAD
  when 'connect' then CONNECT
  when 'options' then OPTIONS
  when 'patch' then PATCH
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/paypal_server_sdk/models/link_http_method.rb', line 35

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

  true
end