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.

Defined Under Namespace

Classes: Response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ GithubClient

Returns a new instance of GithubClient.



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

def initialize(options)
  self.octokit = Octokit::Client.new(access_token:
                                      options[:github_access_token])
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

#last_responseObject



17
18
19
# File 'lib/github_stats/github_client.rb', line 17

def last_response
  octokit.last_response
end

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



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

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