Class: Jiralicious::Issue::Watchers
- Inherits:
-
Base
- Object
- Hashie::Trash
- Base
- Jiralicious::Issue::Watchers
show all
- Defined in:
- lib/jiralicious/issue/watchers.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#loaded
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#all, #endpoint_name, endpoint_name, fetch, find, find_all, handler, #loaded?, #method_missing, #numeric?, parent_name, #parent_name, #properties_from_hash, #reload
#parse!
Constructor Details
#initialize(decoded_json = nil, default = nil, &blk) ⇒ Watchers
Returns a new instance of Watchers.
9
10
11
12
13
14
15
|
# File 'lib/jiralicious/issue/watchers.rb', line 9
def initialize(decoded_json = nil, default = nil, &blk)
if (decoded_json != nil)
properties_from_hash(decoded_json)
super(decoded_json)
parse!(decoded_json)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Jiralicious::Base
Instance Attribute Details
#jira_key ⇒ Object
Returns the value of attribute jira_key.
7
8
9
|
# File 'lib/jiralicious/issue/watchers.rb', line 7
def jira_key
@jira_key
end
|
Class Method Details
.add(name, key) ⇒ Object
25
26
27
|
# File 'lib/jiralicious/issue/watchers.rb', line 25
def add(name, key)
fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})
end
|
.find_by_key(key) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/jiralicious/issue/watchers.rb', line 18
def find_by_key(key)
response = fetch({:parent => parent_name, :parent_key => key})
a = new(response)
a.jira_key = key
return a
end
|
.remove(name, key) ⇒ Object
29
30
31
|
# File 'lib/jiralicious/issue/watchers.rb', line 29
def remove(name, key)
fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})
end
|
Instance Method Details
#add(name) ⇒ Object
38
39
40
|
# File 'lib/jiralicious/issue/watchers.rb', line 38
def add(name)
self.class.add(name, @jira_key)
end
|
#find ⇒ Object
34
35
36
|
# File 'lib/jiralicious/issue/watchers.rb', line 34
def find
self.class.find_by_key(@jira_key)
end
|
#remove(name) ⇒ Object
42
43
44
|
# File 'lib/jiralicious/issue/watchers.rb', line 42
def remove(name)
self.class.remove(name, @jira_key)
end
|