Sha256: 30d916e0b2f8028f5ea3a72ba98fb8a879513081bd3e53b7690d855a206c1e07

Contents?: true

Size: 935 Bytes

Versions: 20

Compression:

Stored size: 935 Bytes

Contents

module FBGraph
  class Realtime < Base

    def initialize(client)
      @objects = 'subscriptions'
      super(client)
    end

    
    OBJECTS = %w(user permissions errors).freeze

    OBJECTS.each do |object|
      class_eval  <<-METHOD
        def #{object}
          @params[:object] = "#{object}"
          self
        end
      METHOD
    end

    def fields(fs = "email,picture")
      @params[:fields] = fs
      self
    end

    def callback_url(url)
      @params[:callback_url] = url
      self
    end

    def veryfy_token(token)
      @params[:veryfy_token] = token
      self
    end 


    alias_method :subscribe! , :publish! 
    
    private
    
    def build_open_graph_path(objects,connection_type = nil , params = {})
      request = "/" + [objects , connection_type].compact.join('/')
      request += "?"+params.to_a.map{|p| p.join('=')}.join('&') unless params.empty?
      request
    end
    
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
fbgraph-1.10.0 lib/fbgraph/realtime.rb
fbgraph-1.9.0 lib/fbgraph/realtime.rb
fbgraph-1.8.4 lib/fbgraph/realtime.rb
fbgraph-1.8.3 lib/fbgraph/realtime.rb
fbgraph-1.8.0 lib/fbgraph/realtime.rb
fbgraph-1.7.1 lib/fbgraph/realtime.rb
fbgraph-1.7.0 lib/fbgraph/realtime.rb
fbgraph-1.6.0 lib/fbgraph/realtime.rb
fbgraph-1.5.4 lib/fbgraph/realtime.rb
fbgraph-1.5.2 lib/fbgraph/realtime.rb
fbgraph-0.1.6.4.1 lib/fbgraph/realtime.rb
fbgraph-0.1.6.4 lib/fbgraph/realtime.rb
fbgraph-0.1.6.3 lib/fbgraph/realtime.rb
fbgraph-0.1.6.1 lib/fbgraph/realtime.rb
fbgraph-0.1.6 lib/fbgraph/realtime.rb
fbgraph-0.1.4 lib/fbgraph/realtime.rb
fbgraph-0.1.1 lib/fbgraph/realtime.rb
fbgraph-0.0.9 lib/fbgraph/realtime.rb
fbgraph-0.0.8 lib/fbgraph/realtime.rb
fbgraph-0.0.5 lib/fbgraph/realtime.rb