Class: PinboardClient

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pinboard_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ PinboardClient

Returns a new instance of PinboardClient.



8
9
10
11
# File 'lib/pinboard_client.rb', line 8

def initialize(opts)
  @options = {:basic_auth => {:username => opts[:user], :password => opts[:pass]}}
  self.class.http_proxy(*opts.values_at(:proxy_host, :proxy_port, :proxy_user, :proxy_pass))
end

Instance Method Details

#delete(url) ⇒ Object



20
21
22
# File 'lib/pinboard_client.rb', line 20

def delete(url)
  self.class.get("/posts/delete?url=#{url}", @options)
end

#get_urlsObject



13
14
15
16
17
18
# File 'lib/pinboard_client.rb', line 13

def get_urls
  response = self.class.get('/posts/all', @options)
  if response.success?
    response['posts']['post'].map { |post| post['href'] }
  end
end