Giter Club home page Giter Club logo

feedlr's Introduction

Feedlr - A Ruby interface to Feedly API

Gem Version Build Status Coverage Status Dependency Status Code Climate

A Ruby interface to Feedly API.

API Support

  • Categories API
  • Entries API
  • Evernote API
  • Facebook API
  • Feeds API
  • Markers API
  • Microsoft API
  • Mixes API
  • OPML API
  • Preferences API
  • Profile API
  • Search API
  • Streams API
  • Subscriptions API
  • Tags API
  • Topics API
  • Twitter API
  • URL Shortener API

Supported Ruby Versions

Feedlr is tested under 2.0, 2.1, 2.2, JRuby(1.9 mode) and Rubinius 2.2.7.

Installation

Add this line to your application's Gemfile:

gem 'feedlr'

And then execute:

$ bundle

Or install it yourself as:

$ gem install feedlr

Usage

Basic usage

require 'feedlr'
client = Feedlr::Client.new(oauth_access_token: 'oauth access token')
# Fetch user categories
p client.user_categories
# Fetch user subscriptions
p client.user_subscriptions

Detailed API

You can easily inspect the available client methods:

client = Feedlr::Client.new
p client.api_methods

Also, the gem is fairly documented. Browse the YARD documentaion for more information.

Global configuration

You can have a global configuration that instances can use. For example, you can have the following in some initializer's code:

Feedlr.configure do |config|
  config.oauth_access_token = 'oauth access token'
  config.sandbox = true
  config.logger = SomeCustomLogger.new
end

And elsewhere you can do:

client = Feedlr::Client.new

Instance initialization

You can set the oauth access token, a custom logger(if needed) and whether or not to use the client on sandbox(develpment) mode:

require 'logger'
client = Feedlr::Client.new(
  oauth_access_token: 'oauth access token',
  sandbox: true,
  logger: Logger.new(STDOUT)
)

Pagination

Some requests support pagination(continuation)

cursor = client.stream_entries_contents(stream_id)
cursor.each { |page| p page.items.map(&:title) }

For those requests, you will get enumerable paginated results Feedlr::Cursor. Calling each or each_page on a Feedlr::Cursor object yields the response and any follow up responses.

There are a few other helper methods that make it easy to control response paging:

cursor.last_page? #=> false
cursor.next_page? #=> true

# gets the next page, returns nil for the last page
resp = cursor.next_page

# gets each response in a loop
resp = cursor.next_page until cursor.last_page?

Rate limiting

The client deals with a variaty of errors. The errors have a corresponding rate_limit object that maps to the returned rate limiting headers if any.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

feedlr's People

Contributors

khelll avatar askn avatar y-ken avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.