rflak
rflak is simple gem to use flaker.pl API. flaker.pl is polish microblogging website. For more information please visit flaker.pl.
From version 0.4 rflak is compatible with Ruby 1.9
Instalation
To install rflak gem just simply execute command written below:
gem install rflak
Docs & Examples
You can simply user two classes Flaker and Traker. Flaker class can fetch all entries scoped with conditions described in flaker’s API. You can check API blog.flaker.pl/api described in polish.
Flaker.fetch('user') do |flak|
flak.login 'seban'
flak.limit 2
flak.tag 'ruby'
end
With Traker class it is possible to fetch entries from traker service. You can visit flaker.pl/traker to see traker in your browser.
Traker.fetch do |traker|
traker.url 'http://blog.sebastiannowak.net'
traker.limit 20
end
User operations
Authenticate user by login and API key.
user = User.auth('my_login', 'my_api_key')
# user authenticated
user.nil? == false
# user not authenticated
user.nil? == true
Create new entry, only authenticated user can post new entry
user = User.auth('my_login', 'my_api_key')
Entry.create(user, { :text => "My super text" }
Get user’s tags, bookmarks, followers and following users:
user.
user.bookmarks
user.followers
user.following
Bookmark entry. Only authorized user can bookmark entry.
entry = Flaker.fetch('show' { |f| f.entry_id(123456) }
user = User.auth('my_login', 'my_api_key')
entry.bookmark(user) if user
Add comments to some entry:
entry = Rflak::Flaker.fetch("show") { |f| f.entry_id '2725807' ; f.comments true }.first
user = Rflak::User.auth('my_login','my_api_key')
entry.comment(user,'my comment here')
# or
Comment.create(entry, user, 'my comment here')
# or
Comment.create(entry.id, user, 'my comment here')