Class: Mock::Twilio::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, body, request, headers: nil) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
13
# File 'lib/mock/twilio/response.rb', line 8

def initialize(status_code, body, request, headers: nil)
  @status_code = status_code
  body = '{}' if !body || body.empty?
  @body = Mock::Twilio::Decorator.call(body, request)
  @headers = !headers ? {} : headers.to_hash
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/mock/twilio/response.rb', line 6

def body
  @body
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/mock/twilio/response.rb', line 6

def headers
  @headers
end

#status_codeObject

Returns the value of attribute status_code.



6
7
8
# File 'lib/mock/twilio/response.rb', line 6

def status_code
  @status_code
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/mock/twilio/response.rb', line 15

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