Class: GithubStats::GithubClient

Inherits:
Object
  • Object
show all
Defined in:
lib/github_stats/github_client.rb

Overview

Encapsulates github interactions so we can inject boring defaults and auto-paginate and potentially throttle or whatever.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GithubClient

Returns a new instance of GithubClient.



7
8
9
10
11
# File 'lib/github_stats/github_client.rb', line 7

def initialize(options)
  self.octokit = Octokit::Client.new(access_token:
                                      options[:github_access_token],
                                     auto_paginate: true)
end

Instance Attribute Details

#octokitObject

Returns the value of attribute octokit.



5
6
7
# File 'lib/github_stats/github_client.rb', line 5

def octokit
  @octokit
end

Instance Method Details

#search_issues(query, options = { per_page: 100 }) ⇒ Object



13
14
15
# File 'lib/github_stats/github_client.rb', line 13

def search_issues(query, options = { per_page: 100 })
  octokit.search_issues(query, options)
end