Sha256: f2ef0a17a248bb15cf9d7ebf4289c236cd7370204fbb4955c587f429519b3db9

Contents?: true

Size: 746 Bytes

Versions: 692

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

module Files
  class Response
    attr_accessor :data, :http_body, :http_headers, :http_status

    def self.from_faraday_hash(http_resp)
      resp = new
      resp.data = JSON.parse(http_resp[:body], symbolize_names: true) if http_resp[:status] != 204
      resp.http_body = http_resp[:body]
      resp.http_headers = http_resp[:headers]
      resp.http_status = http_resp[:status]
      resp
    end

    def self.from_faraday_response(http_resp)
      resp = new
      resp.data = JSON.parse(http_resp.body, symbolize_names: true) if http_resp.status != 204
      resp.http_body = http_resp.body
      resp.http_headers = http_resp.headers
      resp.http_status = http_resp.status
      resp
    end
  end
end

Version data entries

692 entries across 692 versions & 1 rubygems

Version Path
files.com-1.0.117 lib/files.com/response.rb
files.com-1.0.116 lib/files.com/response.rb
files.com-1.0.115 lib/files.com/response.rb
files.com-1.0.114 lib/files.com/response.rb
files.com-1.0.113 lib/files.com/response.rb
files.com-1.0.112 lib/files.com/response.rb
files.com-1.0.111 lib/files.com/response.rb
files.com-1.0.110 lib/files.com/response.rb
files.com-1.0.109 lib/files.com/response.rb
files.com-1.0.108 lib/files.com/response.rb
files.com-1.0.107 lib/files.com/response.rb
files.com-1.0.106 lib/files.com/response.rb
files.com-1.0.105 lib/files.com/response.rb
files.com-1.0.104 lib/files.com/response.rb
files.com-1.0.103 lib/files.com/response.rb
files.com-1.0.102 lib/files.com/response.rb
files.com-1.0.101 lib/files.com/response.rb
files.com-1.0.100 lib/files.com/response.rb
files.com-1.0.99 lib/files.com/response.rb
files.com-1.0.98 lib/files.com/response.rb