Sha256: 44a94ff2d48bfa41bb5d0235edbe49ba5367c6febbde938d3c8bdf8361ea27be

Contents?: true

Size: 360 Bytes

Versions: 17

Compression:

Stored size: 360 Bytes

Contents

module Twilio
  class Response
    attr_accessor :status_code, :body, :headers

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

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
twilio-ruby-5.8.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.8.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.7.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.7.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.7.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.6.4 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.6.3 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.6.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.6.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.6.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.5.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.5.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.4.5 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.4.4 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.4.3 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.4.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.4.1 lib/twilio-ruby/framework/response.rb