Sha256: 51297c4d658d22f1eb8cb32b0da96cbfb8af64109cf60f00a6c0a06958dc7c88

Contents?: true

Size: 683 Bytes

Versions: 12

Compression:

Stored size: 683 Bytes

Contents

module SocialProfile
  class Response
    attr_reader :uri, :response, :body, :headers

    def initialize(uri, response, options={})
      @uri          = uri
      @response     = response
      @body         = response.body || options[:body]
      @headers      = response.to_hash
    end

    def code
      response.code.to_i
    end

    def respond_to?(name)
      return true if [:uri, :response, :body, :headers].include?(name)
      response.respond_to?(name)
    end

    protected

      def method_missing(name, *args, &block)
        if response.respond_to?(name)
          response.send(name, *args, &block)
        else
          super
        end
      end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
social_profile-0.3.2 lib/social_profile/response.rb
social_profile-0.3.1 lib/social_profile/response.rb
social_profile-0.3.0 lib/social_profile/response.rb
social_profile-0.2.2 lib/social_profile/response.rb
social_profile-0.2.1 lib/social_profile/response.rb
social_profile-0.2.0 lib/social_profile/response.rb
social_profile-0.1.4 lib/social_profile/response.rb
social_profile-0.1.3 lib/social_profile/response.rb
social_profile-0.1.2 lib/social_profile/response.rb
social_profile-0.1.1 lib/social_profile/response.rb
social_profile-0.1.0 lib/social_profile/response.rb
social_profile-0.0.1 lib/social_profile/response.rb