Class: FdxV660Api::HttpActionType

Inherits:
Object
  • Object
show all
Defined in:
lib/fdx_v660_api/models/http_action_type.rb

Overview

HTTP Methods to use for requests

Constant Summary collapse

HTTP_ACTION_TYPE =
[
  # TODO: Write general description for DELETE
  DELETE = 'DELETE'.freeze,

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

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

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

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = DELETE) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fdx_v660_api/models/http_action_type.rb', line 32

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

  str = value.to_s.strip

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

.validate(value) ⇒ Object



26
27
28
29
30
# File 'lib/fdx_v660_api/models/http_action_type.rb', line 26

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

  true
end