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
27 28 29 30 31 |
# File 'lib/squake/response.rb', line 27 def error return if success? Squake::APIError.new(response: self) end |
#error_message ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/squake/response.rb', line 34 def return if success? <<~TXT Failed Request http_code=#{code} body=#{::Oj.dump(body, Squake::OJ_CONFIG)} original_request_http_method=#{original_request.method} original_request_http_path=#{original_request.path} TXT end |
#failure? ⇒ Boolean
22 23 24 |
# File 'lib/squake/response.rb', line 22 def failure? !success? end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/squake/response.rb', line 17 def success? code >= 200 && code < 300 end |