Class: ReposWatching
- Inherits:
-
Object
- Object
- ReposWatching
- Defined in:
- lib/github/repos/repos_watching.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
Instance Method Summary collapse
- #checkIfWatching(repo, user = nil) ⇒ Object
-
#initialize(github) ⇒ ReposWatching
constructor
A new instance of ReposWatching.
- #listWatchedRepos(user = nil) ⇒ Object
- #listWatchers(repo, user = nil) ⇒ Object
- #stopWatching(repo, user = nil) ⇒ Object
- #watchRepo(repo, user = nil) ⇒ Object
Constructor Details
#initialize(github) ⇒ ReposWatching
Returns a new instance of ReposWatching.
4 5 6 |
# File 'lib/github/repos/repos_watching.rb', line 4 def initialize(github) @github = github end |
Instance Attribute Details
#github ⇒ Object
Returns the value of attribute github.
2 3 4 |
# File 'lib/github/repos/repos_watching.rb', line 2 def github @github end |
Instance Method Details
#checkIfWatching(repo, user = nil) ⇒ Object
19 20 21 22 |
# File 'lib/github/repos/repos_watching.rb', line 19 def checkIfWatching(repo, user=nil) username = user == nil ? @github.username : user @github.get('user/watched/%s/%s' % [username, repo]) end |
#listWatchedRepos(user = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/github/repos/repos_watching.rb', line 13 def listWatchedRepos(user=nil) url = (user != nil and user != @github.username) ? 'users/%s/watched' % user : 'user/watched' @github.get(url) end |
#listWatchers(repo, user = nil) ⇒ Object
8 9 10 11 |
# File 'lib/github/repos/repos_watching.rb', line 8 def listWatchers(repo, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/watchers' % [username, repo]) end |
#stopWatching(repo, user = nil) ⇒ Object
29 30 31 32 |
# File 'lib/github/repos/repos_watching.rb', line 29 def stopWatching(repo, user=nil) username = user == nil ? @github.username : user @github.delete('user/watched/%s/%s' % [username, repo]) end |
#watchRepo(repo, user = nil) ⇒ Object
24 25 26 27 |
# File 'lib/github/repos/repos_watching.rb', line 24 def watchRepo(repo, user=nil) username = user == nil ? @github.username : user @github.put('user/watched/%s/%s' % [username, repo]) end |