Class: Gitorinox::GithubAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/gitorinox/github_api.rb

Instance Method Summary collapse

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(, password)
  @client ||= Github.new(login: , password: password)
end

Instance Method Details

#authenticated_usernameObject



27
28
29
# File 'lib/gitorinox/github_api.rb', line 27

def authenticated_username
  @client.users.get.
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., repo: repository.name)
end