Sha256: ccfbd065bd3710ca6ab3e502347f70f0083f1156aa069e69da1f11b992d58568

Contents?: true

Size: 537 Bytes

Versions: 3

Compression:

Stored size: 537 Bytes

Contents

module WebClient
  class Response

    def initialize(response)
      @response = response
    end

    def type
      @response.class
    end

    def success?
      @response.is_a? Net::HTTPSuccess
    end

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

    def methods
      (super | @response.methods).uniq
    end

    def respond_to?(method)
      super || @response.respond_to?(method)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
web_client-0.0.6 lib/web_client/response.rb
web_client-0.0.5 lib/web_client/response.rb
web_client-0.0.4 lib/web_client/response.rb