Sha256: 4b12b4ce01ae14404925f76d7c0ac0ddd3402ee26cdb292f8d8707f489a5604f
Contents?: true
Size: 787 Bytes
Versions: 3
Compression:
Stored size: 787 Bytes
Contents
# encoding: utf-8 require 'faraday' require 'base64' module Github class Request class BasicAuth < Faraday::Middleware dependency 'base64' # @api private def initialize(app, *args) @app = app @auth = nil options = args.extract_options! if options.key?(:login) && !options[:login].nil? credentials = "#{options[:login]}:#{options[:password]}" @auth = Base64.encode64(credentials) @auth.gsub!("\n", "") end end # Update request headers # # @api private def call(env) if @auth env[:request_headers].merge!('Authorization' => "Basic #{@auth}") end @app.call(env) end end # BasicAuth end # Request end # Github
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
github_api-0.19.0 | lib/github_api/request/basic_auth.rb |
lingfennan-github_api-0.18.2 | lib/github_api/request/basic_auth.rb |
github_api-0.18.2 | lib/github_api/request/basic_auth.rb |