Class: Ksql::Connection::Response
- Inherits:
-
Object
- Object
- Ksql::Connection::Response
- Defined in:
- lib/ksql/connection/response.rb
Constant Summary collapse
- STATUS_KEY =
':status'.freeze
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Check whether or not a Request has returned an Error.
-
#initialize(body:, headers:) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(body:, headers:) ⇒ Response
Returns a new instance of Response.
10 11 12 13 |
# File 'lib/ksql/connection/response.rb', line 10 def initialize(body:, headers:) @body = JSON.parse(body) @headers = headers end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/ksql/connection/response.rb', line 6 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/ksql/connection/response.rb', line 6 def headers @headers end |
Instance Method Details
#error? ⇒ Boolean
Check whether or not a Request has returned an Error
20 21 22 |
# File 'lib/ksql/connection/response.rb', line 20 def error? !headers[STATUS_KEY].to_s.match?(/20[01]/) end |