Graph api in ruby on rails for add to timeline - ruby-on-rails

Whats the best available plugin for add to timeline implementations in rails. I have already implemented fetching friends, I have fb token etc. I used https://github.com/appoxy/mini_fb gem for that.
I want to implement a functionality ie add_to_timeline. Something like pintrest has. Take a look on screenshot.
Whats the best possible Gem/guide for this.
PS: I am not asking for the code, an example is good to have, even guidance for the gem or plugin is even enough :)

This is facebook open graph. You'll have to define actions and objects. Read this:
https://developers.facebook.com/docs/opengraph/keyconcepts/

https://github.com/nov/fb_graph
app = FbGraph::Application.new(APP_ID)
me = FbGraph::User.me(ACCESS_TOKEN)
# Fetch activities
actions = me.og_actions app.og_action(:custom_action)
# Publish an activity
action = me.og_action!(
app.og_action(:custom_action),
:custom_object => 'http://samples.ogp.me/264755040233381')
https://github.com/nov/fb_graph/wiki/OpenGraph
And as kenny said, you'll have to create your own custom actions and objects on Facebook.

Related

Facebook like user search as you type

I am creating a messaging system for my web app and need help with searching for users to send messages to. So far I have it so that if you type a persons name (who is on the site) you can send a message to them. I want it to be as you start typing a persons name, a drop down appears with users names that the current user is following. Any thoughts on how I can do this?
I am using the gem mailboxer also wondering if anyone has suggestions for a better messaging gem. Thanks in advance.
Use jQuery autocomplete, and just populate the dropdown contents as all users that the user is following... something like current_user.followed_users. It's impossible to give code without seeing how your code works though.
A good alternative to jquery autocomplete is http://loopj.com/jquery-tokeninput/ and github at: https://github.com/loopj/jquery-tokeninput. A facebook like tagging to send message to multiple users. A demo app on https://github.com/railscasts/258-token-fields-revised/tree/master/bookstore-tokeninput-after from Ryan Bates from Railscasts http://railscasts.com/episodes/258-token-fields-revised
Good luck.

Rails Facebook-like Notifications

In my Rails 3 app I have Users, Products, and Likes. If a User posts a Product, and another User Likes this Product, I want that User to get a notification that their Product was Liked.
Is there an existing gem that handles this? I've only come across Pusher but that seems to be overkill.
There are a couple of gems that do that:
RailsActivity
https://www.ruby-toolbox.com/categories/Rails_Activity_Feeds
PublicActivity
http://railscasts.com/episodes/406-public-activity
https://github.com/pokonski/public_activity
I have never used them (although i probably will do it tomorrow ^^) so maybe someone with more experience can give you a better insight given your requirements (or read some part of the documentation)
All the gems that are mentioned above by different people is for implementing activity feed.There is lot of difference between implementing facebook news feed and facebook notification system.
For implementing notification system, I recommend you to check these links.
Gritter
Link
Have you seen this http://railscasts.com/episodes/260-messaging-with-faye ? Faye is used in the example. I'm not sure if you'd still consider it an overkill.

How do I grab meta data from other websites and display on mine in ruby on rails?

When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.
How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.
For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?
Kind regards
I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby
You should likely use a gem like http://nokogiri.org/
It allows you to work with a html page just as you would do with jQuery. Very handy.

How to implement notification system in RoR?

I finished Ruby on Rails tutorial where I can follow other users and others may follow me like twitter. Now I wonder how to implement notification system if someone starts to follow me, for example, as in stackexchange or facebook in which come and display a notification (eg red 1). How to go about it? Are there any examples of ready solutions you or MVC?
I'd add a before_filter to relevant controller actions that checks for new followers in the database and sets flash[:notice] to something useful like 'X new followers' and links to your followers page. There's a quick overview of how flash works in the docs: http://api.rubyonrails.org/classes/ActionDispatch/Flash.html
Have a look at those 2 railscasts:
http://railscasts.com/episodes/407-activity-feed-from-scratch
http://railscasts.com/episodes/406-public-activity.

What is the best way to embed a user's tweets and mentions into a website?

I need to embed a specific user's recent tweets onto the home page of a website. The website is built in ASP.NET.
I've looked at the Twitter REST API and have tried using the user_timeline. It works but does not include mentions for the user. I want to include mentions but the only way to do it seems to be by using APIs that require authentication. I would prefer not to use authentication as it seems it would start to make things more complicated. I also do not want to get the current user to authenticate.
What is the best way to achieve this?
Use the GET search API instead. Search for statuses containing the user's #username, but in this case it will not return mentions from private/locked accounts since there's no authentication.
For example, if you want to search mentions for #stackexchange, call this.
GET http://search.twitter.com/search.json?q=#stackexchange
You could do a search for #username using the REST Search api. There's a good chance that would work :)

Resources