Class: Gitorinox::GithubAPI
- Inherits:
-
Object
- Object
- Gitorinox::GithubAPI
- Defined in:
- lib/gitorinox/github_api.rb
Instance Method Summary collapse
- #authenticated_username ⇒ Object
-
#initialize(login, password) ⇒ GithubAPI
constructor
A new instance of GithubAPI.
- #matched_repositories(match) ⇒ Object
- #unwatch(repository) ⇒ Object
Constructor Details
#initialize(login, password) ⇒ GithubAPI
Returns a new instance of GithubAPI.
3 4 5 |
# File 'lib/gitorinox/github_api.rb', line 3 def initialize(login, password) @client ||= Github.new(login: login, password: password) end |
Instance Method Details
#authenticated_username ⇒ Object
27 28 29 |
# File 'lib/gitorinox/github_api.rb', line 27 def authenticated_username @client.users.get.login end |
#matched_repositories(match) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gitorinox/github_api.rb', line 7 def matched_repositories(match) result = [] @client.activity.watching.watched.each_page do |page| page.each do |repo| if match result << repo if repo.name.match(match) else result << repo end end end result end |
#unwatch(repository) ⇒ Object
23 24 25 |
# File 'lib/gitorinox/github_api.rb', line 23 def unwatch(repository) @client.activity.watching.delete(user: repository.owner.login, repo: repository.name) end |