Sha256: 305429c313060ec8042bc03cac49a5c7787809f6c01eeca3f599926af9f31c4c

Contents?: true

Size: 391 Bytes

Versions: 187

Compression:

Stored size: 391 Bytes

Contents

# frozen_string_literal: true

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

187 entries across 187 versions & 2 rubygems

Version Path
whoosh-ruby-0.1.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-6.0.1 lib/twilio-ruby/framework/response.rb
whoosh-ruby-0.1.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-6.0.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-6.0.0.pre.rc.3 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.77.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-6.0.0.pre.rc.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.76.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-6.0.0.pre.rc.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.75.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.5 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.4 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.3 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.1 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.74.0 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.73.4 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.73.3 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.73.2 lib/twilio-ruby/framework/response.rb
twilio-ruby-5.73.1 lib/twilio-ruby/framework/response.rb