class JIRA::Resource::Watcher

Public Class Methods

all(client, options = {}) click to toggle source
# File lib/jira/resource/watcher.rb, line 15
def self.all(client, options = {})
  issue = options[:issue]
  raise ArgumentError, 'parent issue is required' unless issue

  path = "#{issue.self}/#{endpoint_name}"
  response = client.get(path)
  json = parse_json(response.body)
  json['watchers'].map do |watcher|
    issue.watchers.build(watcher)
  end
end
endpoint_name() click to toggle source
# File lib/jira/resource/watcher.rb, line 11
def self.endpoint_name
  'watchers'
end

Public Instance Methods

save!(user_id, path = nil) click to toggle source
# File lib/jira/resource/watcher.rb, line 27
def save!(user_id, path = nil)
  path ||= new_record? ? url : patched_url
  response = client.post(path, user_id.to_json)
  true
end