Sha256: f2ef0a17a248bb15cf9d7ebf4289c236cd7370204fbb4955c587f429519b3db9

Contents?: true

Size: 746 Bytes

Versions: 688

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

688 entries across 688 versions & 1 rubygems

Version Path
files.com-1.0.73 lib/files.com/response.rb
files.com-1.0.1 lib/files.com/response.rb
files.com-1.0.72 lib/files.com/response.rb
files.com-1.0.71 lib/files.com/response.rb
files.com-1.0.70 lib/files.com/response.rb
files.com-1.0.69 lib/files.com/response.rb
files.com-1.0.68 lib/files.com/response.rb
files.com-1.0.67 lib/files.com/response.rb
files.com-1.0.66 lib/files.com/response.rb
files.com-1.0.65 lib/files.com/response.rb
files.com-1.0.64 lib/files.com/response.rb
files.com-1.0.63 lib/files.com/response.rb
files.com-1.0.62 lib/files.com/response.rb
files.com-1.0.61 lib/files.com/response.rb
files.com-1.0.60 lib/files.com/response.rb
files.com-1.0.59 lib/files.com/response.rb
files.com-1.0.58 lib/files.com/response.rb
files.com-1.0.57 lib/files.com/response.rb
files.com-1.0.56 lib/files.com/response.rb
files.com-1.0.55 lib/files.com/response.rb