Class: IssuesLabels

Inherits:
Object
  • Object
show all
Defined in:
lib/github/issues/issues_labels.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ IssuesLabels

Returns a new instance of IssuesLabels.



4
5
6
# File 'lib/github/issues/issues_labels.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/issues/issues_labels.rb', line 2

def github
  @github
end

Instance Method Details

#addIssueLabel(repo, id, labels, user = nil) ⇒ Object



48
49
50
51
52
53
# File 'lib/github/issues/issues_labels.rb', line 48

def addIssueLabel(repo, id, labels, user=nil)
  params = labels
  data = params.to_json
  url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
  @github.post(url, data)
end

#createLabel(repo, name, color, user = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/github/issues/issues_labels.rb', line 18

def createLabel(repo, name, color, user=nil)
  params = {
      :name => name,
      :color => color
  }
  data = params.to_json
  url = 'repos/%s/%s/labels' % [repo, user]
  @github.post(url, data)
end

#deleteIssueLabel(repo, issue_id, label_id, user = nil) ⇒ Object



55
56
57
58
# File 'lib/github/issues/issues_labels.rb', line 55

def deleteIssueLabel(repo, issue_id, label_id, user=nil)
  url = 'repos/%s/%s/issues/%s/labels/%s' % [repo, user, issue_id, label_id]
  @github.delete(url)
end

#deleteLabel(repo, id, user = nil) ⇒ Object



38
39
40
41
# File 'lib/github/issues/issues_labels.rb', line 38

def deleteLabel(repo, id, user=nil)
  url = 'repos/%s/%s/labels/%s' % [repo, user, id]
  @github.delete(url)
end

#editLabel(repo, id, name, color, user = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/github/issues/issues_labels.rb', line 28

def editLabel(repo, id, name, color, user=nil)
  params = {
      :name => name,
      :color => color
  }
  data = params.to_json
  url = 'repos/%s/%s/labels/%s' % [repo, user, id]
  @github.patch(url, data)
end

#getIssueLabels(repo, id, user = nil) ⇒ Object



43
44
45
46
# File 'lib/github/issues/issues_labels.rb', line 43

def getIssueLabels(repo, id, user=nil)
  url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
  @github.get(url)
end

#getIssueMilestoneLabels(repo, id, user = nil) ⇒ Object



72
73
74
75
# File 'lib/github/issues/issues_labels.rb', line 72

def getIssueMilestoneLabels(repo, id, user=nil)
  url = 'repos/%s/%s/milestones/%s/labels' % [repo, user, id]
  @github.get(url)
end

#getLabel(repo, id, user = nil) ⇒ Object



13
14
15
16
# File 'lib/github/issues/issues_labels.rb', line 13

def getLabel(repo, id, user=nil)
  url = 'repos/%s/%s/labels/%s' % [repo, user, id]
  @github.get(url)
end

#listRepoLabels(repo, user = nil) ⇒ Object



8
9
10
11
# File 'lib/github/issues/issues_labels.rb', line 8

def listRepoLabels(repo, user=nil)
  url = 'repos/%s/%s/labels' % [repo, user]
  @github.get(url)
end

#removeIssueLabels(repo, id, user = nil) ⇒ Object



67
68
69
70
# File 'lib/github/issues/issues_labels.rb', line 67

def removeIssueLabels(repo, id, user=nil)
  url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
  @github.delete(url)
end

#replaceIssueLabels(repo, id, labels, user = nil) ⇒ Object



60
61
62
63
64
65
# File 'lib/github/issues/issues_labels.rb', line 60

def replaceIssueLabels(repo, id, labels, user=nil)
  params = labels
  data = params.to_json
  url = 'repos/%s/%s/issues/%s/labels' % [repo, user, id]
  @github.put(url, data)
end