File: token_authentication.rb

package info (click to toggle)
ruby-asana 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 384 kB
  • ctags: 289
  • sloc: ruby: 1,361; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 500 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Asana
  module Authentication
    # Public: Represents an API token authentication mechanism.
    class TokenAuthentication
      def initialize(token)
        @token = token
      end

      # Public: Configures a Faraday connection injecting its token as
      # basic auth.
      #
      # builder - [Faraday::Connection] the Faraday connection instance.
      #
      # Returns nothing.
      def configure(connection)
        connection.basic_auth(@token, '')
      end
    end
  end
end