Class: ReposForks
- Inherits:
-
Object
- Object
- ReposForks
- Defined in:
- lib/github/repos/repos_forks.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
Instance Method Summary collapse
- #createFork(repo, org = nil, user = nil) ⇒ Object
-
#initialize(github) ⇒ ReposForks
constructor
A new instance of ReposForks.
- #listForks(repo, sort = nil, user = nil) ⇒ Object
Constructor Details
#initialize(github) ⇒ ReposForks
Returns a new instance of ReposForks.
4 5 6 |
# File 'lib/github/repos/repos_forks.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_forks.rb', line 2 def github @github end |
Instance Method Details
#createFork(repo, org = nil, user = nil) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/github/repos/repos_forks.rb', line 17 def createFork(repo, org=nil, user=nil) username = user == nil ? @github.username : user url = 'repos/%s/%s/forks' % [username, repo] if org url = '%s?%s=%s' % [url, 'org', org] end @github.post(url) end |
#listForks(repo, sort = nil, user = nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/github/repos/repos_forks.rb', line 8 def listForks(repo, sort=nil, user=nil) username = user == nil ? @github.username : user url = 'repos/%s/%s/forks' % [username, repo] if sort url = '%s?%s=%s' % ['sort', sort] end @github.get(url) end |