Class: Zensana::Asana::Task
- Inherits:
-
Object
- Object
- Zensana::Asana::Task
show all
- Includes:
- Access
- Defined in:
- lib/zensana/models/asana/task.rb
Constant Summary
collapse
- FIELDS =
[
'id', 'name', 'notes', 'created_at', 'created_by.name',
'completed', 'assignee.name', 'tags.name', 'followers.name'
]
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Access
#asana_service
Constructor Details
#initialize(id) ⇒ Task
Returns a new instance of Task.
13
14
15
|
# File 'lib/zensana/models/asana/task.rb', line 13
def initialize(id)
@attributes = fetch(id)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
41
42
43
|
# File 'lib/zensana/models/asana/task.rb', line 41
def method_missing(name, *args, &block)
attributes[name.to_s] || super
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
11
12
13
|
# File 'lib/zensana/models/asana/task.rb', line 11
def attributes
@attributes
end
|
Instance Method Details
#attachments ⇒ Object
37
38
39
|
# File 'lib/zensana/models/asana/task.rb', line 37
def attachments
@attachments ||= fetch_attachments(self.id)
end
|
#is_section? ⇒ Boolean
21
22
23
|
# File 'lib/zensana/models/asana/task.rb', line 21
def is_section?
self.name.end_with?(':') rescue false
end
|
#section_name ⇒ Object
25
26
27
|
# File 'lib/zensana/models/asana/task.rb', line 25
def section_name
self.name.chop if is_section?
end
|
#stories ⇒ Object
33
34
35
|
# File 'lib/zensana/models/asana/task.rb', line 33
def stories
@stories ||= story_list(self.id)
end
|
#subtasks ⇒ Object
29
30
31
|
# File 'lib/zensana/models/asana/task.rb', line 29
def subtasks
@subtasks ||= fetch_subtasks(self.id)
end
|
17
18
19
|
# File 'lib/zensana/models/asana/task.rb', line 17
def tags
attributes['tags'].map { |t| t['name'] } if attributes['tags']
end
|