Sha256: 9a698722e201a29417e32617ab3c31541dc131b4ace3d30ccb5036923cf368fc

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

module FbGraph
  module Connections
    module Likes
      def likes(options = {})
        likes = if @_likes_ && options.blank?
          self.connection(:likes, options.merge(:cached_collection => @_likes_))
        else
          self.connection(:likes, options)
        end
        likes.map! do |like|
          like.merge!(
            :access_token => options[:access_token] || self.access_token
          )
          if like[:category]
            Page.new(like[:id], like)
          else
            User.new(like[:id], like)
          end
        end
      end

      module Likable
        def like!(options = {})
          post(options.merge(:connection => :likes))
        end

        def unlike!(options = {})
          destroy(options.merge(:connection => :likes))
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fb_graph-2.2.2 lib/fb_graph/connections/likes.rb
fb_graph-2.2.1 lib/fb_graph/connections/likes.rb
fb_graph-2.2.0 lib/fb_graph/connections/likes.rb
fb_graph-2.2.0.beta lib/fb_graph/connections/likes.rb