Sha256: 3efaab7f7455fd97eb9daeca2ab1c24351673cbe171a74f8dbdb809f9b47be7b

Contents?: true

Size: 856 Bytes

Versions: 4

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require 'acfs/response/formats'
require 'acfs/response/status'
require 'active_support/core_ext/module/delegation'

module Acfs
  # This represents a response. In addition to an standard HTTP
  # it has a field `data` for storing the encoded body.
  #
  class Response
    attr_accessor :data
    attr_reader :headers, :body, :request, :status

    include Response::Formats
    include Response::Status

    # delegate :status, :status_message, :success?, :modified?, :timed_out?,
    #         :response_body, :response_headers, :response_code, :headers,
    #         to: :response

    def initialize(request, data = {})
      @request  = request
      @status   = data[:status]  || 0
      @headers  = data[:headers] || {}
      @body     = data[:body]    || ''
      @data     = data[:data]    || nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acfs-1.5.1 lib/acfs/response.rb
acfs-1.5.0 lib/acfs/response.rb
acfs-1.4.0 lib/acfs/response.rb
acfs-1.3.4 lib/acfs/response.rb