Method: Toolshed::Git::Github#initialize
- Defined in:
- lib/toolshed/git/github.rb
#initialize(options = {}) ⇒ Github
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/toolshed/git/github.rb', line 12 def initialize( = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength super() username = Toolshed::Client.instance.github_username password = Toolshed::Client.instance.github_password token = Toolshed::Client.instance.github_token username = [:username] unless [:username].nil? password = [:password] unless [:password].nil? unless token.nil? username = token password = nil end unless [:token].nil? username = [:token] password = nil end @auth = { username: username, password: password } self. = { headers: { 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17' # rubocop:disable Metrics/LineLength }, basic_auth: @auth } end |