Class: WalmartApIs::HttpMethod
- Inherits:
-
Object
- Object
- WalmartApIs::HttpMethod
- Defined in:
- lib/walmart_ap_is/models/http_method.rb
Overview
The HTTP method associated with the individual APIs being called as part of the batch request.
Constant Summary collapse
- HTTP_METHOD =
[ # TODO: Write general description for GET GET = 'GET'.freeze, # TODO: Write general description for PUT PUT = 'PUT'.freeze, # TODO: Write general description for PATCH PATCH = 'PATCH'.freeze, # TODO: Write general description for DELETE DELETE = 'DELETE'.freeze, # TODO: Write general description for POST POST = 'POST'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = GET) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/walmart_ap_is/models/http_method.rb', line 33 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 'put' then PUT when 'patch' then PATCH when 'delete' then DELETE when 'post' then POST else default_value end end |
.validate(value) ⇒ Object
27 28 29 30 31 |
# File 'lib/walmart_ap_is/models/http_method.rb', line 27 def self.validate(value) return false if value.nil? HTTP_METHOD.include?(value) end |