Sha256: 1f80fd912939438e26dc700f050773c06a6627e9fd5588490725778a52e83aab

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 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, **opts)
      @request  = request
      @status   = opts[:status]  || 0
      @headers  = opts[:headers] || {}
      @body     = opts[:body]    || ''
      @data     = opts[:data]    || nil
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acfs-2.0.0 lib/acfs/response.rb
acfs-1.7.0 lib/acfs/response.rb
acfs-1.6.0 lib/acfs/response.rb