module LogCabin::Modules::GithubApi

Provide an api method for modules to query GitHub

Public Instance Methods

github_api() click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 8
def github_api
  cached_clients[@endpoint] ||= Octokit::Client.new(octokit_args)
end

Private Instance Methods

auth() click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 29
def auth
  @auth ||= Octoauth.new(octoauth_args)
end
cached_clients() click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 25
def cached_clients
  @cached_clients ||= {}
end
endpoint(value) click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 47
def endpoint(value)
  @endpoint = value
end
octoauth_args() click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 33
def octoauth_args
  args = {
    note: 'Prospectus',
    file: :default,
    autosave: true
  }
  args[:api_endpoint] = @endpoint if @endpoint
  args
end
octokit_args() click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 14
def octokit_args
  args = {
    access_token: auth.token,
    auto_paginate: true
  }
  args[:api_endpoint] = @endpoint if @endpoint
  args
end
repo(value) click to toggle source
# File lib/prospectus/helpers/github_api.rb, line 43
def repo(value)
  @repo = value
end