jirarest2 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/issuelink.rb DELETED
@@ -1,74 +0,0 @@
1
- # Watcher class
2
- # Copyright (C) 2012 Cyril Bitterich
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- #
17
-
18
- require "connect"
19
- =begin
20
- Watchers do have their own calling
21
- =end
22
- class Watcher
23
-
24
- =begin
25
- We expect to receive an existing
26
- :connection
27
- :issueid
28
- =end
29
- def initialize(connection,issueid)
30
- @connection = connection
31
- @uritail = "issue/#{issueid}/watchers"
32
- end
33
-
34
-
35
- =begin
36
- Return all the watchers of the issue
37
- =end
38
- def get_watchers
39
- ret = @connection.execute("Get",@uritail,"").result
40
- watchers = Array.new
41
- ret["watchers"].each { |entry|
42
- watchers << entry["name"]
43
- }
44
- return watchers
45
- end
46
-
47
- =begin
48
- Adds a new watcher for the issue
49
- =end
50
- def add_watcher(username)
51
- ret = @connection.execute("Post",@uritail,username)
52
- case ret.code
53
- when "204"
54
- return true
55
- else
56
- return false
57
- end
58
- end
59
-
60
- =begin
61
- removes one watcher from the issue
62
- =end
63
- def remove_watcher(username)
64
- query = {"username" => username}
65
- ret = @connection.execute("Delete",@uritail,query)
66
- case ret.code # Have to decide what to do here (Work with exceptions or with the case block)
67
- when "204"
68
- return true
69
- else
70
- false
71
- end
72
- end
73
-
74
- end