Class: Delicious_Api

Inherits:
Object
  • Object
show all
Defined in:
lib/graphiclious/delicious_api.rb

Overview

These are the only methods that we actually use within Graphiclious. The current implementation uses Rubilicious to realise them. This might change over time.

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ Delicious_Api

Returns a new instance of Delicious_Api.



85
86
87
88
89
# File 'lib/graphiclious/delicious_api.rb', line 85

def initialize(user, password)
  @interface = Rubilicious.new(user, password)
  @interface.base_uri = 'https://api.del.icio.us/v1'
  @interface
end

Instance Method Details

#allObject



113
114
115
# File 'lib/graphiclious/delicious_api.rb', line 113

def all
  @interface.all
end

#bundlesObject



99
100
101
# File 'lib/graphiclious/delicious_api.rb', line 99

def bundles
  @interface.bundles
end

#recentObject



103
104
105
106
107
108
109
110
111
# File 'lib/graphiclious/delicious_api.rb', line 103

def recent
  links = @interface.recent(nil, 25)
  return nil unless links
  # make sure that format is equal to format in #all
  links.each { |v|
    v["extended"] = "" unless v["extended"]
  }
  links
end

#timestampObject

This method should be used before calling #all. Store this time locally after each call of #all. Compare the stored time with the time returned by this method to decide if an update is necessary.



95
96
97
# File 'lib/graphiclious/delicious_api.rb', line 95

def timestamp
  @interface.update
end