Class: Sendbird::Response
- Inherits:
-
Object
- Object
- Sendbird::Response
- Defined in:
- lib/sendbird/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #error_code ⇒ Object
- #error_message ⇒ Object
-
#initialize(status, body) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status, body) ⇒ Response
Returns a new instance of Response.
4 5 6 7 |
# File 'lib/sendbird/response.rb', line 4 def initialize(status, body) @status = status @body = JSON[body] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/sendbird/response.rb', line 3 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/sendbird/response.rb', line 3 def status @status end |
Instance Method Details
#error_code ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/sendbird/response.rb', line 17 def error_code if body['error'] body['code'] else 'Not any error to report' end end |
#error_message ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/sendbird/response.rb', line 9 def if body['error'] body['message'] else 'Not any error to report' end end |