Module: Wrest::HttpCodes
- Included in:
- Native::Response
- Defined in:
- lib/wrest/http_codes.rb
Overview
Contains convenience methods to check HTTP response codes
Instance Method Summary collapse
- #accepted? ⇒ Boolean
- #bad_request? ⇒ Boolean
- #created? ⇒ Boolean
- #forbidden? ⇒ Boolean
- #found? ⇒ Boolean
- #internal_server_error? ⇒ Boolean
- #method_not_allowed? ⇒ Boolean
- #moved_permanently? ⇒ Boolean
- #no_content? ⇒ Boolean
- #not_acceptable? ⇒ Boolean
- #not_found? ⇒ Boolean
- #not_modified? ⇒ Boolean
- #ok? ⇒ Boolean
- #see_other? ⇒ Boolean
- #temporary_redirect? ⇒ Boolean
- #unauthorized? ⇒ Boolean
- #unprocessable_entity? ⇒ Boolean
Instance Method Details
#accepted? ⇒ Boolean
23 24 25 |
# File 'lib/wrest/http_codes.rb', line 23 def accepted? code.to_i == 202 end |
#bad_request? ⇒ Boolean
51 52 53 |
# File 'lib/wrest/http_codes.rb', line 51 def bad_request? code.to_i == 400 end |
#created? ⇒ Boolean
19 20 21 |
# File 'lib/wrest/http_codes.rb', line 19 def created? code.to_i == 201 end |
#forbidden? ⇒ Boolean
59 60 61 |
# File 'lib/wrest/http_codes.rb', line 59 def forbidden? code.to_i == 403 end |
#found? ⇒ Boolean
35 36 37 |
# File 'lib/wrest/http_codes.rb', line 35 def found? code.to_i == 302 end |
#internal_server_error? ⇒ Boolean
79 80 81 |
# File 'lib/wrest/http_codes.rb', line 79 def internal_server_error? code.to_i == 500 end |
#method_not_allowed? ⇒ Boolean
67 68 69 |
# File 'lib/wrest/http_codes.rb', line 67 def method_not_allowed? code.to_i == 405 end |
#moved_permanently? ⇒ Boolean
31 32 33 |
# File 'lib/wrest/http_codes.rb', line 31 def moved_permanently? code.to_i == 301 end |
#no_content? ⇒ Boolean
27 28 29 |
# File 'lib/wrest/http_codes.rb', line 27 def no_content? code.to_i == 204 end |
#not_acceptable? ⇒ Boolean
71 72 73 |
# File 'lib/wrest/http_codes.rb', line 71 def not_acceptable? code.to_i == 406 end |
#not_found? ⇒ Boolean
63 64 65 |
# File 'lib/wrest/http_codes.rb', line 63 def not_found? code.to_i == 404 end |
#not_modified? ⇒ Boolean
43 44 45 |
# File 'lib/wrest/http_codes.rb', line 43 def not_modified? code.to_i == 304 end |
#ok? ⇒ Boolean
15 16 17 |
# File 'lib/wrest/http_codes.rb', line 15 def ok? code.to_i == 200 end |
#see_other? ⇒ Boolean
39 40 41 |
# File 'lib/wrest/http_codes.rb', line 39 def see_other? code.to_i == 303 end |
#temporary_redirect? ⇒ Boolean
47 48 49 |
# File 'lib/wrest/http_codes.rb', line 47 def temporary_redirect? code.to_i == 307 end |
#unauthorized? ⇒ Boolean
55 56 57 |
# File 'lib/wrest/http_codes.rb', line 55 def code.to_i == 401 end |
#unprocessable_entity? ⇒ Boolean
75 76 77 |
# File 'lib/wrest/http_codes.rb', line 75 def unprocessable_entity? code.to_i == 422 end |