lib/facebooker/session.rb in facebooker-1.0.63 vs lib/facebooker/session.rb in facebooker-1.0.64
- old
+ new
@@ -422,18 +422,43 @@
Photo.from_hash(hash)
end
end
end
+ #remove a comment from a given xid stream with comment_id
+ def remove_comment(xid,comment_id)
+ post('facebook.comments.remove', :xid=>xid, :comment_id =>comment_id)
+ end
+
+ #pulls comment list for a given XID
+ def get_comments(xid)
+ @comments = post('facebook.comments.get', :xid => xid) do |response|
+ response.map do |hash|
+ Comment.from_hash(hash)
+ end
+ end
+ end
+
def get_albums(aids)
@albums = post('facebook.photos.getAlbums', :aids => aids) do |response|
response.map do |hash|
Album.from_hash(hash)
end
end
end
+ ###
+ # Retrieve a viewer's facebook stream
+ # See http://wiki.developers.facebook.com/index.php/Stream.get for options
+ #
+ def get_stream(viewer_id, options = {})
+
+ @stream = post('facebook.stream.get', prepare_get_stream_options(viewer_id, options), true) do |response|
+ response
+ end
+ end
+
def get_tags(pids)
@tags = post('facebook.photos.getTags', :pids => pids) do |response|
response.map do |hash|
Tag.from_hash(hash)
end
@@ -721,9 +746,21 @@
Digest::MD5.hexdigest([raw_string, secret_for_method(params[:method])].join)
end
def ensure_array(value)
value.is_a?(Array) ? value : [value]
+ end
+
+ def prepare_get_stream_options(viewer_id, options)
+ opts = {}
+
+ opts[:viewer_id] = viewer_id if viewer_id.is_a?(Integer)
+ opts[:source_ids] = options[:source_ids] if options[:source_ids]
+ opts[:start_time] = options[:start_time].to_i if options[:start_time]
+ opts[:end_time] = options[:end_time].to_i if options[:end_time]
+ opts[:limit] = options[:limit] if options[:limit].is_a?(Integer)
+ opts[:metadata] = Facebooker.json_encode(options[:metadata]) if options[:metadata]
+ opts
end
end
class CanvasSession < Session
def default_login_url_options