Skip to content

a-chernykh/delicious

Repository files navigation

Gem Version Build Status Coverage Status Code Climate

Delicious API wrapper

This gem is a delicious.com oAuth API client. It supports pretty much everything delicious API allows to do:

Delicious API requires you to obtain user's oAuth token in order to access his/her account programmatically.

Requirements

Ruby versions higher than or equal to 1.9.3 are supported.

Installation

Add the following line into your Gemfile:

gem 'delicious', '~> 1.0.0'

Client configuration

You should obtain access token first.

client = Delicious::Client.new do |config|
  config.access_token = 'my-access-token'
end

Bookmarks

Get bookmarks

client.bookmarks.all returns all bookmarks created by user associated with access token. You can paginate results:

client.bookmarks.all.offset(50).limit(100)

It's possible to filter by tag, starting and ending dates:

client.bookmarks.all.tag('angular').from('2013/11/12 10:23:00').to('2013/11/13 12:10:00')

Create

client.bookmarks.create url:         'http://example.com',
                        description: 'Example bookmark',
                        tags:        'tag1,tag2,tag3'

It returns an instance of Delicious::Post which responds to persisted?.

Delete

If you have an instance of Delicious::Post which was saved, you can call delete on it:

post = client.bookmarks.create url: 'http://example.com', description: 'Example bookmark'
post.delete if post.persisted? # => true if bookmark was deleted, false otherwise

You can also delete bookmark with a client:

client.bookmarks.delete url: 'http://example.com' # => true if bookmark was deleted, false otherwise

Bundles

Bundles are named list of tags. See the following example for how to create a new bundle:

Create

bundle = client.bundles.set 'bundlename', %w(tag1 tag2)

It returns an instance of Delicious::Bundle on success and throws Delicious::Error if something went wrong on the server.

Delete

You can call bundle.delete or client.bundles.delete('bundlename') to delete existing bundle. It returns true on successful deletion and false otherwise.

Find by bundle name

bundle = client.bundles.find 'bundlename'

All bundles

bundles = client.bundles.all

Tags

Get all tags

tags = client.tags.all

Delete tag

client.tags.delete 'tag'

Rename tag

client.tags.rename 'old_name', 'new_name'

Links

About

Ruby wrapper for delicious.com API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages