Class: ReposCollaborators

Inherits:
Object
  • Object
show all
Defined in:
lib/github/repos/repos_collaborators.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ ReposCollaborators

Returns a new instance of ReposCollaborators.



4
5
6
# File 'lib/github/repos/repos_collaborators.rb', line 4

def initialize(github)
  @github = github
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



2
3
4
# File 'lib/github/repos/repos_collaborators.rb', line 2

def github
  @github
end

Instance Method Details

#addCollaborator(repo, collaborator, user = nil) ⇒ Object



18
19
20
21
# File 'lib/github/repos/repos_collaborators.rb', line 18

def addCollaborator(repo, collaborator, user=nil)
  username = user == nil ? @github.username : user
  @github.put('repos/%s/%s/collaborators/%s' % [username, repo, collaborator])
end

#deleteCollaborator(repo, collaborator, user = nil) ⇒ Object



23
24
25
26
# File 'lib/github/repos/repos_collaborators.rb', line 23

def deleteCollaborator(repo, collaborator, user=nil)
  username = user == nil ? @github.username : user
  @github.delete('repos/%s/%s/collaborators/%s' % [username, repo, collaborator])
end

#get(repo, collaborator, user = nil) ⇒ Object



13
14
15
16
# File 'lib/github/repos/repos_collaborators.rb', line 13

def get(repo, collaborator, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/collaborators/%s' % [username, repo, collaborator])
end

#list(repo, user = nil) ⇒ Object



8
9
10
11
# File 'lib/github/repos/repos_collaborators.rb', line 8

def list(repo, user=nil)
  username = user == nil ? @github.username : user
  @github.get('repos/%s/%s/collaborators' % [username, repo])
end