Class: Sidemash::Sdk::HttpMethod
- Inherits:
-
Object
- Object
- Sidemash::Sdk::HttpMethod
- Defined in:
- lib/sidemash/sdk/http_method.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .all_possibles_values ⇒ Object
- .delete ⇒ Object
- .from_s(value) ⇒ Object
- .get ⇒ Object
- .patch ⇒ Object
- .post ⇒ Object
- .put ⇒ Object
- .valid?(value) ⇒ Boolean
Instance Method Summary collapse
- #delete? ⇒ Boolean
- #get? ⇒ Boolean
-
#initialize(value) ⇒ HttpMethod
constructor
A new instance of HttpMethod.
- #not_delete? ⇒ Boolean
- #not_get? ⇒ Boolean
- #not_patch? ⇒ Boolean
- #not_post? ⇒ Boolean
- #not_put? ⇒ Boolean
- #patch? ⇒ Boolean
- #post? ⇒ Boolean
- #put? ⇒ Boolean
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ HttpMethod
Returns a new instance of HttpMethod.
24 25 26 |
# File 'lib/sidemash/sdk/http_method.rb', line 24 def initialize(value) @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
22 23 24 |
# File 'lib/sidemash/sdk/http_method.rb', line 22 def value @value end |
Class Method Details
.all_possibles_values ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/sidemash/sdk/http_method.rb', line 48 def self.all_possibles_values Set['GET', 'POST', 'PUT', 'DELETE', 'PATCH'] end |
.delete ⇒ Object
40 41 42 |
# File 'lib/sidemash/sdk/http_method.rb', line 40 def self.delete HttpMethod.new('DELETE') end |
.from_s(value) ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/sidemash/sdk/http_method.rb', line 56 def self.from_s(value) case value when 'GET' then HttpMethod.get when 'POST' then HttpMethod.post when 'PUT' then HttpMethod.put when 'DELETE' then HttpMethod.delete when 'PATCH' then HttpMethod.patch else nil end end |
.get ⇒ Object
28 29 30 |
# File 'lib/sidemash/sdk/http_method.rb', line 28 def self.get HttpMethod.new('GET') end |
.patch ⇒ Object
44 45 46 |
# File 'lib/sidemash/sdk/http_method.rb', line 44 def self.patch HttpMethod.new('PATCH') end |
.post ⇒ Object
32 33 34 |
# File 'lib/sidemash/sdk/http_method.rb', line 32 def self.post HttpMethod.new('POST') end |
.put ⇒ Object
36 37 38 |
# File 'lib/sidemash/sdk/http_method.rb', line 36 def self.put HttpMethod.new('PUT') end |
.valid?(value) ⇒ Boolean
67 68 69 |
# File 'lib/sidemash/sdk/http_method.rb', line 67 def self.valid?(value) HttpMethod.all_possibles_values.include? value end |
Instance Method Details
#delete? ⇒ Boolean
103 104 105 |
# File 'lib/sidemash/sdk/http_method.rb', line 103 def delete? @value == 'DELETE' end |
#get? ⇒ Boolean
91 92 93 |
# File 'lib/sidemash/sdk/http_method.rb', line 91 def get? @value == 'GET' end |
#not_delete? ⇒ Boolean
83 84 85 |
# File 'lib/sidemash/sdk/http_method.rb', line 83 def not_delete? @value != 'DELETE' end |
#not_get? ⇒ Boolean
71 72 73 |
# File 'lib/sidemash/sdk/http_method.rb', line 71 def not_get? @value != 'GET' end |
#not_patch? ⇒ Boolean
87 88 89 |
# File 'lib/sidemash/sdk/http_method.rb', line 87 def not_patch? @value != 'PATCH' end |
#not_post? ⇒ Boolean
75 76 77 |
# File 'lib/sidemash/sdk/http_method.rb', line 75 def not_post? @value != 'POST' end |
#not_put? ⇒ Boolean
79 80 81 |
# File 'lib/sidemash/sdk/http_method.rb', line 79 def not_put? @value != 'PUT' end |
#patch? ⇒ Boolean
107 108 109 |
# File 'lib/sidemash/sdk/http_method.rb', line 107 def patch? @value == 'PATCH' end |
#post? ⇒ Boolean
95 96 97 |
# File 'lib/sidemash/sdk/http_method.rb', line 95 def post? @value == 'POST' end |
#put? ⇒ Boolean
99 100 101 |
# File 'lib/sidemash/sdk/http_method.rb', line 99 def put? @value == 'PUT' end |
#to_json(*a) ⇒ Object
111 112 113 |
# File 'lib/sidemash/sdk/http_method.rb', line 111 def to_json(*a) @value end |
#to_s ⇒ Object
115 116 117 |
# File 'lib/sidemash/sdk/http_method.rb', line 115 def to_s @value end |