Sha256: 09e88d81e1d865e5a68c7e5826d66dc04e785a9c73feadfabbeb0fcffc31016b
Contents?: true
Size: 801 Bytes
Versions: 4
Compression:
Stored size: 801 Bytes
Contents
module Brief::GithubClient class Authentication attr_accessor :github_token, :options InvalidAuth = Class.new(Exception) def initialize(options={}) options.symbolize_keys! if options.is_a?(Hash) @options = options fetch_token end protected def fetch_token @github_token = case when options.respond_to?(:github_token) options.github_token when options.is_a?(Hash) && options.has_key?(:github_token) options[:github_token] when options.is_a?(Hash) && (options.has_key?(:username) && options.has_key?(:password)) raise "Not implemented. use personal access tokens." when "#{ENV['GITHUB_TOKEN']}".length > 1 ENV['GITHUB_TOKEN'] else raise InvalidAuth end end end end
Version data entries
4 entries across 4 versions & 1 rubygems