Class: Watcher
Overview
Watchers do have their own calling
Instance Method Summary collapse
-
#add_watcher(username) ⇒ Boolean
Adds a new watcher for the issue.
-
#get_watchers ⇒ String
Return all the watchers of the issue.
-
#initialize(connection, issueid) ⇒ Watcher
constructor
Set our uritail.
-
#remove_watcher(username) ⇒ Boolean
remove one watcher from the issue.
Methods inherited from Services
Constructor Details
#initialize(connection, issueid) ⇒ Watcher
Set our uritail
27 28 29 30 |
# File 'lib/jirarest2/services/watcher.rb', line 27 def initialize(connection, issueid) @uritail = "issue/#{issueid}/watchers" super(connection) end |
Instance Method Details
#add_watcher(username) ⇒ Boolean
Adds a new watcher for the issue
48 49 50 51 52 53 54 55 56 |
# File 'lib/jirarest2/services/watcher.rb', line 48 def add_watcher(username) ret = post(username) case ret.code when "204" return true else return false end end |
#get_watchers ⇒ String
Return all the watchers of the issue
35 36 37 38 39 40 41 42 |
# File 'lib/jirarest2/services/watcher.rb', line 35 def get_watchers ret = get watchers = Array.new ret["watchers"].each { |entry| watchers << entry["name"] } return watchers end |
#remove_watcher(username) ⇒ Boolean
remove one watcher from the issue
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/jirarest2/services/watcher.rb', line 62 def remove_watcher(username) query = {"username" => username} ret = delete(query) case ret.code # Have to decide what to do here (Work with exceptions or with the case block) when "204" return true else false end end |