Ping.fm Ruby Class
Posted on July 8th, 2008 in Ruby |
Ping.fm is simple service for updating multi social networks. Ping.fm currently supports 18 social networks and custom url. Although it’s in beta, it works great.
Updating is possible thru variety of services/tools: AOL instant messenger, GTalk, iPhone Web app… Developer API is also available and it’s subject of this blog post.
I wrote a Ping.fm Ruby Class which acts as a wrapper for Ping.fm API. Using ping.fm class is easy (you’ll need a API key as well as user app key):
require "pingfm"
pingfm = Pingfm.new("abcde", "12345")
# abcde is API key and 12345 user app key
puts pingfm.validate()["status"]
# return OK if successful, otherwise FAIL
Posting is also easy:
require "pingfm"
pingfm = Pingfm.new("abcde", "12345")
pingfm.post("this is posted to all my services")
Class supports all Ping.fm API calls. All methods are well documented.
You can grab Ping.fm Ruby Class here:
pingfm.rb.tar.gz
pingfm.rb.zip
You can also get refactored version of Ping.fm Ruby Class done by Dale Campbell at http://github.com/Oshuma/pingfm/

9 Responses
Hi, I’m discovering your wrapper, thanks for this;
I’m writing now because I have some problems using it.
mainly with the pingfm.latest(), wich give me an error :
NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.text
from /home/demo/public_html/pingfm/lib/pingfm.rb:174:in `status_fail’
from /home/demo/public_html/pingfm/lib/pingfm.rb:118:in `latest’
from (irb):53
Do I use it wrong ?
At the same time, I don’t manage to parse the responses’ hashes, if youy’d ever give some more examples; would be great.
So thanks anyway.
The examples you give works great though.
Hi bbnnt!
I will post today or tomorrow more examples of using ping.fm ruby class.
Regarding the error you mentioned, I can reproduce it too. Problem is that ping.fm api sends invalid response (not FAIL nor OK). I’m contacting ping.fm developers now…
Updates when I get some information, stand by…
Thanks for getting the ball rolling on this! I’ve started to refactor it a bit. You can find the code here: http://github.com/Oshuma/pingfm/
@Dale Campbell:
Good job! Thanks for notifying me! I updated post and added link to your code.
@bbnnt:
I spoked with Sean from Ping.fm about problem when using “latest” method. There was invalid method response from Ping.fm service when there is no recent messages posted. Now fixed and “latest” method should work as expected.
@h00s Awesome. If you have any changes, send me a pull request on Github and I’ll add them.
Hello from Russia
Sweet … thanks for this, we’ll be looking at using this in XLsuite
Success is the ability to go from one failure to another with no loss of enthusiasm.