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.93 lib/files.com/response.rb
files.com-1.0.92 lib/files.com/response.rb
files.com-1.0.91 lib/files.com/response.rb
files.com-1.0.90 lib/files.com/response.rb
files.com-1.0.89 lib/files.com/response.rb
files.com-1.0.88 lib/files.com/response.rb
files.com-1.0.87 lib/files.com/response.rb
files.com-1.0.86 lib/files.com/response.rb
files.com-1.0.85 lib/files.com/response.rb
files.com-1.0.84 lib/files.com/response.rb
files.com-1.0.83 lib/files.com/response.rb
files.com-1.0.82 lib/files.com/response.rb
files.com-1.0.81 lib/files.com/response.rb
files.com-1.0.80 lib/files.com/response.rb
files.com-1.0.79 lib/files.com/response.rb
files.com-1.0.78 lib/files.com/response.rb
files.com-1.0.77 lib/files.com/response.rb
files.com-1.0.76 lib/files.com/response.rb
files.com-1.0.75 lib/files.com/response.rb
files.com-1.0.74 lib/files.com/response.rb