Class Facebooker::BatchRequest
In: lib/facebooker/batch_request.rb
Parent: Object

Methods

Classes and Modules

Class Facebooker::BatchRequest::UnexecutedRequest

Attributes

method  [R] 
uri  [R] 

Public Class methods

[Source]

# File lib/facebooker/batch_request.rb, line 7
    def initialize(params,proc)
      @exception  = nil
      @result     = nil
      @method     = params[:method]
      @uri        = params.map{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join("&")
      @proc       = proc
    end

Public Instance methods

[Source]

# File lib/facebooker/batch_request.rb, line 31
    def ===(other)
      other === @result
    end

[Source]

# File lib/facebooker/batch_request.rb, line 19
    def exception_raised=(ex)
      @exception=ex
    end

[Source]

# File lib/facebooker/batch_request.rb, line 23
    def exception_raised?
      @exception.nil? ? false : raise(@exception)
    end

[Source]

# File lib/facebooker/batch_request.rb, line 35
    def method_missing(name,*args,&proc)
      if @exception
        raise @exception
      elsif @result.nil?
        raise UnexecutedRequest.new("You must execute the batch before accessing the result: #{@uri}")
      else
        @result.send(name,*args,&proc)
      end
    end

[Source]

# File lib/facebooker/batch_request.rb, line 27
    def respond_to?(name)
      super || @result.respond_to?(name)
    end

[Source]

# File lib/facebooker/batch_request.rb, line 15
    def result=(result_object)
      @result = @proc.nil? ? result_object : @proc.call(result_object)
    end

[Validate]