Sha256: 30bfa9ae8305b479f566e40eed1b9d329a67f171676e586236090bb4f8bb5ac7

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

# encoding: utf-8

require 'faraday'

module Github
  # Contains methods and attributes that act on the response returned from the 
  # request
  class Response < Faraday::Response::Middleware

    CONTENT_TYPE = 'Content-Type'.freeze

    class << self
      attr_accessor :parser
    end

    def self.define_parser(&block)
      @parser = block
    end

    def response_type(env)
      env[:response_headers][CONTENT_TYPE].to_s
    end

    def parse_response?(env)
      env[:body].respond_to? :to_str
    end

  end # Response
end # Github

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
github_api-0.7.2 lib/github_api/response.rb
github_api-0.7.1 lib/github_api/response.rb
github_api-0.7.0 lib/github_api/response.rb