Module: Analysand::StatusCodePredicates
- Included in:
- ConfigResponse, Response, StreamingViewResponse
- Defined in:
- lib/analysand/status_code_predicates.rb
Instance Method Summary collapse
- #code ⇒ Object
- #conflict? ⇒ Boolean
- #not_found? ⇒ Boolean
- #success? ⇒ Boolean
- #unauthorized? ⇒ Boolean
Instance Method Details
#code ⇒ Object
3 4 5 |
# File 'lib/analysand/status_code_predicates.rb', line 3 def code response.code end |
#conflict? ⇒ Boolean
21 22 23 |
# File 'lib/analysand/status_code_predicates.rb', line 21 def conflict? code.to_i == 409 end |
#not_found? ⇒ Boolean
17 18 19 |
# File 'lib/analysand/status_code_predicates.rb', line 17 def not_found? code.to_i == 404 end |
#success? ⇒ Boolean
7 8 9 10 11 |
# File 'lib/analysand/status_code_predicates.rb', line 7 def success? c = code.to_i c >= 200 && c <= 299 end |
#unauthorized? ⇒ Boolean
13 14 15 |
# File 'lib/analysand/status_code_predicates.rb', line 13 def code.to_i == 401 end |