Sha256: 02f06748e4725108ac9ee41a1e07614a9ba7472b4df971250980a00165a1ce7b

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module FBGraph
  class Selection < Base

    OBJECTS = %w(user album event group link note page photo post status
                 video comment checkin friendlist thread order application
                 apprequest).freeze

    CONNECTION_TYPES = %w(home photos comments feed	noreply
                          maybe invited attending declined picture
                          members tagged links groups albums
                          statuses	videos notes posts events friends
                          activities interests music books movies television
                          likes inbox outbox updates accounts checkins
                          friendlists platformrequests threads participants
                          former_participants senders messages insights
                          subscriptions payments apprequests reviews).freeze

    OBJECTS.each do |object|
      class_eval  <<-METHOD
        def #{object}(object)
          find(object)
          self
        end
     METHOD
    end

    CONNECTION_TYPES.each do |object|
      class_eval  <<-METHOD
        def #{object}
          connection('#{object}')
          self
        end
      METHOD
    end


    def me
      find('me')
    end


    def action(namespace,action)
      connection([namespace,action].join(':'))
      self
    end

    def metadata
      @params.merge!({:metadata => '1'})
      self
    end

    def picture(type='square')
      params = {:type => type}
      params.merge!(:access_token => @client.access_token) unless @client.access_token.blank?
      uri = [@client.facebook_uri , build_open_graph_path(@objects , 'picture' , params)].join('/')
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fbgraph-1.9.0 lib/fbgraph/selection.rb