lib/targit/client.rb in targit-1.1.0 vs lib/targit/client.rb in targit-2.0.0

- old
+ new

@@ -5,18 +5,32 @@ ## # Helper module to load a GitHub API client object module Client private + def client + @client ||= _client + end + def _client - files = @options[:authfile].split(',') || [:default] - autosave = @options[:autosave] || true - auth = Octoauth.new note: 'targit', files: files, autosave: autosave + auth = Octoauth.new octoauth_options Octokit::Client.new( access_token: auth.token, api_endpoint: @options[:api_endpoint], web_endpoint: @options[:api_endpoint], auto_paginate: true ) + end + + def octoauth_options + autosave = @options[:autosave] || true + { + note: 'targit', files: authfiles, autosave: autosave, scopes: ['user'] + } + end + + def authfiles + return [:default] unless @options[:authfile] + @authfile ||= @options[:authfile].split(',') end end end