Class: ReposKeys
- Inherits:
-
Object
- Object
- ReposKeys
- Defined in:
- lib/github/repos/repos_keys.rb
Instance Attribute Summary collapse
-
#github ⇒ Object
Returns the value of attribute github.
Instance Method Summary collapse
- #createKey(repo, title, key, user = nil) ⇒ Object
- #deleteKey(repo, id, user = nil) ⇒ Object
- #editKey(repo, id, title = nil, key = nil, user = nil) ⇒ Object
- #getKey(repo, id, user = nil) ⇒ Object
-
#initialize(github) ⇒ ReposKeys
constructor
A new instance of ReposKeys.
- #listKeys(repo, user = nil) ⇒ Object
Constructor Details
#initialize(github) ⇒ ReposKeys
Returns a new instance of ReposKeys.
4 5 6 |
# File 'lib/github/repos/repos_keys.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_keys.rb', line 2 def github @github end |
Instance Method Details
#createKey(repo, title, key, user = nil) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/github/repos/repos_keys.rb', line 18 def createKey(repo, title, key, user=nil) username = user == nil ? @github.username : user params = { :title => title, :key => key } data = params.to_json @github.post('repos/%s/%s/keys' % [username, repo], data) end |
#deleteKey(repo, id, user = nil) ⇒ Object
39 40 41 42 |
# File 'lib/github/repos/repos_keys.rb', line 39 def deleteKey(repo, id, user=nil) username = user == nil ? @github.username : user @github.delete('repos/%s/%s/keys/%s' % [username, repo, id]) end |
#editKey(repo, id, title = nil, key = nil, user = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/github/repos/repos_keys.rb', line 28 def editKey(repo, id, title=nil, key=nil, user=nil) username = user == nil ? @github.username : user params = { :title => title, :key => key } params = @github.removeEmptyParams(params) data = params.to_json @github.patch('repos/%s/%s/keys/%s' % [username, repo, id], data) end |
#getKey(repo, id, user = nil) ⇒ Object
13 14 15 16 |
# File 'lib/github/repos/repos_keys.rb', line 13 def getKey(repo, id, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/keys/%s' % [username, repo, id]) end |
#listKeys(repo, user = nil) ⇒ Object
8 9 10 11 |
# File 'lib/github/repos/repos_keys.rb', line 8 def listKeys(repo, user=nil) username = user == nil ? @github.username : user @github.get('repos/%s/%s/keys' % [username, repo]) end |