Class: Delicious

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/delicious-cli/api.rb

Overview

Documentation:

http://delicious.com/help/api

Class Method Summary collapse

Class Method Details

.posts_all(options = {}) ⇒ Object

posts_all options: (from: github.com/SciDevs/delicious-api/blob/master/api/posts.md#v1postsall)

&tag_separator=comma (optional) - (Recommended) Returns tags separated by a comma, instead of a space character. A space separator is currently used by default to avoid breaking existing clients - these default may change in future API revisions. &tag=TAG (optional) — Filter by this tag. &start=xx (optional) — Start returning posts this many results into the set. &results=xx (optional) — Return up to this many results. By default, up to 1000 bookmarks are returned, and a maximum of 100000 bookmarks is supported via this API. &fromdt=CCYY-MM-DDThh:mm:ssZ (optional) — Filter for posts on this date or later. &todt=CCYY-MM-DDThh:mm:ssZ (optional) — Filter for posts on this date or earlier. &meta=yes (optional) — Include change detection signatures on each item in a ‘meta’ attribute. Clients wishing to maintain a synchronized local store of bookmarks should retain the value of this attribute - its value will change when any significant field of the bookmark changes.



33
34
35
36
37
38
39
40
41
42
# File 'lib/delicious-cli/api.rb', line 33

def self.posts_all(options={})
  options = {:results => 100000}.merge(options)

  result = get('/posts/all', :query=>options)
  begin
    [result["posts"]["post"]].flatten
  rescue
    []
  end
end

.posts_since(time_string) ⇒ Object



44
45
46
47
48
# File 'lib/delicious-cli/api.rb', line 44

def self.posts_since(time_string)
  $log.debug "Retrieving links newer than #{time_string}"
  results = posts_all(:fromdt=>time_string)
  results.select { |r| r["time"] != time_string }
end

.posts_updateObject



12
13
14
15
16
17
18
19
# File 'lib/delicious-cli/api.rb', line 12

def self.posts_update
  result = get('/posts/update')
  if result["update"]
    result["update"]["time"]
  else
    nil
  end
end

.valid_auth?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/delicious-cli/api.rb', line 50

def self.valid_auth?
  not posts_update.nil?
end