module Targit::Client

Helper module to load a GitHub API client object

Private Instance Methods

_client() click to toggle source
# File lib/targit/client.rb, line 14
def _client
  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
  }.compact)
end
authfiles() click to toggle source
# File lib/targit/client.rb, line 34
def authfiles
  return [:default] unless @options[:authfile]
  @authfiles ||= @options[:authfile].split(',')
end
client() click to toggle source
# File lib/targit/client.rb, line 10
def client
  @client ||= _client
end
octoauth_options() click to toggle source
# File lib/targit/client.rb, line 24
def octoauth_options
  {
    note: 'targit',
    files: authfiles,
    autosave: @options[:autosave] || true,
    api_endpoint: @options[:api_endpoint],
    scopes: ['public_repo']
  }
end