Class: Twilio::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/twilio-ruby/framework/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, body) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
# File 'lib/twilio-ruby/framework/response.rb', line 5

def initialize(status_code, body)
  @status_code = status_code
  body = '{}' if !body || body.empty?
  @body = JSON.parse(body)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/twilio-ruby/framework/response.rb', line 3

def body
  @body
end

#status_codeObject

Returns the value of attribute status_code.



3
4
5
# File 'lib/twilio-ruby/framework/response.rb', line 3

def status_code
  @status_code
end

Instance Method Details

#to_sObject



11
12
13
# File 'lib/twilio-ruby/framework/response.rb', line 11

def to_s
  "[#{status_code}] #{body}"
end