Class: Sendbird::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/sendbird/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/sendbird/response.rb', line 3

def body
  @body
end

#statusObject (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_codeObject



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_messageObject



9
10
11
12
13
14
15
# File 'lib/sendbird/response.rb', line 9

def error_message
  if body['error']
    body['message']
  else
    'Not any error to report'
  end
end