Hey there, fellow dev! Ready to supercharge your Ruby app with Feedly's content powerhouse? Let's dive into building a Feedly API integration using the nifty feedlr
gem. Trust me, it's easier than you think!
Before we jump in, make sure you've got:
Got 'em? Great! Let's roll.
First things first, let's get feedlr
on board:
gem install feedlr
Or if you're a Bundler fan (and who isn't?), toss this in your Gemfile:
gem 'feedlr'
Time to get cozy with Feedly. Here's how we set up our client:
require 'feedlr' client = Feedlr::Client.new(oauth_access_token: 'YOUR_API_KEY')
Need OAuth? No sweat, feedlr
's got your back. Check out their docs for the OAuth dance.
Let's get our hands dirty with some basic ops:
user = client.user_profile puts user.id
feeds = client.user_subscriptions feeds.each { |feed| puts feed.title }
entries = client.stream_entries_contents(streamId: 'feed/http://example.com/rss') entries.items.each { |entry| puts entry.title }
Ready to level up? Let's tackle some pro moves:
results = client.search_feeds('ruby programming') results.each { |result| puts result.title }
client.add_tag(entryIds: ['entry1', 'entry2'], tagId: 'user/1234/tag/Ruby')
client.mark_entries_as_read(entryIds: ['entry1', 'entry2'])
Don't let errors catch you off guard. Wrap your API calls in a begin/rescue block:
begin client.user_profile rescue Feedlr::Error => e puts "Oops! #{e.message}" end
Feedly's got limits, so play nice! Keep an eye on those headers:
response = client.user_profile puts "Requests remaining: #{response.raw_headers['x-ratelimit-remaining']}"
And there you have it! You're now armed and dangerous with Feedly API skills. Remember, the feedlr
gem is your trusty sidekick in this journey. For more advanced maneuvers, dive into the Feedly API docs and the feedlr
GitHub repo.
Now go forth and build something awesome! 🚀