Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

theoldreader-api

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

theoldreader-api

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Theoldreader::Api

Ruby wrapper for Theoldreader's API.

Installation

Add this line to your application's Gemfile:

gem 'theoldreader-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install theoldreader-api

Usage

Authentication

First you need to obtain a token for theoldreader user:


require 'theoldreader-api'

Theoldreader::Api.new.accounts_clientlogin(
  Email: 'test@krasnoukhov.com', Passwd: '...', client: 'YourAppName'
)
=> {"SID"=>"none", "LSID"=>"none", "Auth"=>"LyTEJPvTJiSPrCxLu46d"}

With this token you have access to all other methods of Theoldreader's API.

Generic

api = Theoldreader::Api.new("LyTEJPvTJiSPrCxLu46d")

api.call!('get', '/reader/api/0/user-info', {output: 'json'})

call! will pass every option you provide directly to Theoldreader's Api.

Shortcut

api.call('user-info')

api.call('subscription/quickadd', quickadd: 'http://xkcd.com')

api.call('tag/list')

api.call('/reader/subscriptions/export')

call will filter your options to include only those listed in specification for the given endpoint.

call accepts endpoints from Theoldreader::Api::ENDPOINTS.keys as its first

Theoldreader::Api::ENDPOINTS includes all available methods from Theoldreader's API (with 'reader/api/0/' being left out), except those three wich returns specific atom feeds (https://theoldreader.com/reader/atom/...). You can access them if you want with call!

Shortcuts for shortcuts

If you mentally process your endpoint through .downcase.sub(%r{^/+}, '').gsub(%r{[-/]}, '_') you should also get available method for Api.

# to get userinfo
api.user_info

# to add new feed
api.subscription_quickadd(quickadd: 'http://xkcd.com')

# to get the last two unread items
api.stream_contents(
  s: 'user/-/state/com.google/reading-list',
  xt: 'user/-/state/com.google/read',
  n: 2
)

Works only for keys listed in Theoldreader::Api::ENDPOINTS.keys

Advanced Usage

You can change faraday adapter:

require 'net/http/persistent'

Theoldreader::Api.new('LyTEJPvTJiSPrCxLu46d', {adapter: :net_http_persistent})

And you can use API via http instead of https:

Theoldreader::Api.new('LyTEJPvTJiSPrCxLu46d', {use_ssl: false})

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ilzoff/theoldreader-api.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 13 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc