Module: PinboardApi
- Defined in:
- lib/pinboard_api.rb,
lib/pinboard_api/tag.rb,
lib/pinboard_api/post.rb,
lib/pinboard_api/user.rb,
lib/pinboard_api/version.rb,
lib/pinboard_api/exceptions.rb,
lib/pinboard_api/request_utils.rb
Defined Under Namespace
Modules: RequestUtils Classes: InvalidPostError, InvalidResponseError, PinboardApiError, Post, Tag, User
Constant Summary collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
-
.adapter ⇒ Object
Returns the value of attribute adapter.
-
.auth_token ⇒ Object
Returns the value of attribute auth_token.
-
.password ⇒ Object
Returns the value of attribute password.
-
.ssl_options ⇒ Object
Returns the value of attribute ssl_options.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
- .api_url ⇒ Object
- .api_version ⇒ Object
- .connection ⇒ Object
- .request(path, options = {}, &blk) ⇒ Object
Class Attribute Details
.adapter ⇒ Object
Returns the value of attribute adapter.
19 20 21 |
# File 'lib/pinboard_api.rb', line 19 def adapter @adapter end |
.auth_token ⇒ Object
Returns the value of attribute auth_token.
19 20 21 |
# File 'lib/pinboard_api.rb', line 19 def auth_token @auth_token end |
.password ⇒ Object
Returns the value of attribute password.
19 20 21 |
# File 'lib/pinboard_api.rb', line 19 def password @password end |
.ssl_options ⇒ Object
Returns the value of attribute ssl_options.
19 20 21 |
# File 'lib/pinboard_api.rb', line 19 def @ssl_options end |
.username ⇒ Object
Returns the value of attribute username.
19 20 21 |
# File 'lib/pinboard_api.rb', line 19 def username @username end |
Class Method Details
.api_url ⇒ Object
34 35 36 |
# File 'lib/pinboard_api.rb', line 34 def self.api_url "https://api.pinboard.in" end |
.api_version ⇒ Object
30 31 32 |
# File 'lib/pinboard_api.rb', line 30 def self.api_version "v1" end |
.connection ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/pinboard_api.rb', line 38 def self.connection Faraday.new(url: api_url, ssl: ) do |builder| builder.response :logger if ENV["PINBOARD_LOGGER"] builder.response :xml, content_type: /\bxml$/ builder.basic_auth username, password if auth_token.blank? builder.adapter adapter end end |
.request(path, options = {}, &blk) ⇒ Object
47 48 49 50 |
# File 'lib/pinboard_api.rb', line 47 def self.request(path, = {}, &blk) .merge!(auth_token: auth_token) unless auth_token.blank? PinboardApi.connection.get(path, , &blk) end |