Class: Squake::Response
- Inherits:
-
T::Struct
- Object
- T::Struct
- Squake::Response
- Extended by:
- T::Sig
- Defined in:
- lib/squake/response.rb
Instance Method Summary collapse
Instance Method Details
#error ⇒ Object
26 27 28 29 30 |
# File 'lib/squake/response.rb', line 26 def error return if success? Squake::APIError.new(response: self) end |
#error_message ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/squake/response.rb', line 33 def return if success? " Failed Request\n http_code=\#{code}\n body=\#{::Oj.dump(body, Squake::OJ_CONFIG)}\n original_request_http_method=\#{original_request.method}\n original_request_http_path=\#{original_request.path}\n TXT\nend\n" |
#failure? ⇒ Boolean
21 22 23 |
# File 'lib/squake/response.rb', line 21 def failure? !success? end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/squake/response.rb', line 16 def success? code >= 200 && code < 300 end |