class Tasty

Constants

DEFAULT_HEADERS
DELICIOUS_API_URL
VERSION

Attributes

delicious_api_url[RW]
password[RW]
username[RW]

Public Class Methods

new(username, password, delicious_api_url = DELICIOUS_API_URL) click to toggle source

Initialize with your API token

# File lib/tasty.rb, line 20
def initialize(username, password, delicious_api_url = DELICIOUS_API_URL)
  @username = username
  @password = password
  @delicious_api_url = delicious_api_url
end

Public Instance Methods

debug(location = $stderr) click to toggle source
# File lib/tasty.rb, line 26
def debug(location = $stderr)
  self.class.debug_output(location)
end
get(api_method, options = {}) click to toggle source

Call del.icio.us using a particular API method, api_method. The options hash is where you can add any parameters appropriate for the API call.

# File lib/tasty.rb, line 40
def get(api_method, options = {})
  query = {}
  query.merge!(authorization_hash)
  query.merge!({:query => options})
        
  self.class.get(@delicious_api_url + api_method, query)
end
post(api_method, options = {}) click to toggle source

Post to del.icio.us using a particular API method, api_method. The parameters hash is where you add all the required parameters appropriate for the API call.

# File lib/tasty.rb, line 49
def post(api_method, options = {}) 
  query = {}
  query.merge!(authorization_hash)
  query.merge!({:body => options})
            
  self.class.post(@delicious_api_url + api_method, query)    
end
set_http_headers(http_headers = {}) click to toggle source
# File lib/tasty.rb, line 30
def set_http_headers(http_headers = {})
  http_headers.merge!(DEFAULT_HEADERS)
  headers(http_headers)
end
set_timeout(timeout) click to toggle source
# File lib/tasty.rb, line 35
def set_timeout(timeout)
  default_timeout(timeout)
end

Private Instance Methods

authorization_hash() click to toggle source
# File lib/tasty.rb, line 59
def authorization_hash
  {:basic_auth => {:username => @username, :password => @password}}
end