Class: PinboardClient
- Inherits:
-
Object
- Object
- PinboardClient
- Includes:
- HTTParty
- Defined in:
- lib/pinboard_client.rb
Instance Method Summary collapse
- #delete(url) ⇒ Object
- #get_urls ⇒ Object
-
#initialize(opts) ⇒ PinboardClient
constructor
A new instance of PinboardClient.
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) = {: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}", ) end |
#get_urls ⇒ Object
13 14 15 16 17 18 |
# File 'lib/pinboard_client.rb', line 13 def get_urls response = self.class.get('/posts/all', ) if response.success? response['posts']['post'].map { |post| post['href'] } end end |