Sha256: acf382a8e43be96dc1549d1a50952a96345ab1459023007c040bd1d09794dacd

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Rapa
  module Responses
    class BaseResponse
      # @param faraday_response [Faraday::Response]
      def initialize(faraday_response)
        @faraday_response = faraday_response
      end

      # @return [String]
      def body
        faraday_response.body
      end

      # @return [Faraday::Utils::Headers]
      def headers
        faraday_response.headers
      end

      # @return [Integer]
      def status
        faraday_response.status
      end

      private

      # @private
      # @return [Faraday::Response]
      def faraday_response
        @faraday_response
      end

      # @return [Class]
      def resource_class
        raise ::NotImplementedError
      end

      # @private
      def source_or_sources
        raise ::NotImplementedError
      end

      # @private
      # @return [Array<Hash>]
      def sources
        case source_or_sources
        when ::Array
          source_or_sources
        when nil
          []
        else
          [source_or_sources]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapa-0.6.0 lib/rapa/responses/base_response.rb