class Delicious::Client
Attributes
access_token[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
Initializes and configures Delicious
client. The only requires configuration option for now is ‘access_token`. Example:
“‘ruby client = Delicious::Client.new
do |client|
client.access_token = 'my-access-token'
end “‘
# File lib/delicious/client.rb, line 18 def initialize(&block) yield(self) if block_given? end
Public Instance Methods
bookmarks()
click to toggle source
@return [Bookmarks::Api]
# File lib/delicious/client.rb, line 23 def bookmarks @bookmarks ||= Bookmarks::Api.new(self) end
bundles()
click to toggle source
@return [Bundles::Api]
# File lib/delicious/client.rb, line 28 def bundles @bundles ||= Bundles::Api.new(self) end
connection()
click to toggle source
@return [Faraday::Connection]
# File lib/delicious/client.rb, line 38 def connection Faraday.new(url: api_endpoint, headers: headers) do |c| c.request :url_encoded c.response :xml, content_type: /\bxml$/ c.adapter Faraday.default_adapter end end
Private Instance Methods
api_endpoint()
click to toggle source
# File lib/delicious/client.rb, line 48 def api_endpoint 'https://previous.delicious.com'.freeze end
headers()
click to toggle source
# File lib/delicious/client.rb, line 52 def headers { authorization: "Bearer #{access_token}", user_agent: "delicious-ruby #{Delicious.version}" }.freeze end