Class: AllHours::Task
- Inherits:
-
Object
- Object
- AllHours::Task
- Defined in:
- lib/all_hours/task.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#description ⇒ Object
Returns the value of attribute description.
-
#dueAt ⇒ Object
Returns the value of attribute dueAt.
-
#estimate ⇒ Object
Returns the value of attribute estimate.
-
#id ⇒ Object
Returns the value of attribute id.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#project_ids ⇒ Object
Returns the value of attribute project_ids.
-
#section ⇒ Object
Returns the value of attribute section.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#time ⇒ Object
Returns the value of attribute time.
-
#unbillable ⇒ Object
Returns the value of attribute unbillable.
Class Method Summary collapse
- .find(api:, task_id:) ⇒ Object
- .search(api:, limit: 100, query: nil, searchInClosed: false) ⇒ Object
Instance Method Summary collapse
-
#initialize(data:, api:) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(data:, api:) ⇒ Task
Returns a new instance of Task.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/all_hours/task.rb', line 23 def initialize data:, api: @api = api @id = data["id"] @name = data["name"] @project_ids = data["project_ids"] @section = data["section"] @labels = data["labels"] @tags = data["tags"] @position = data["position"] @description = data["description"] @dueAt = Date.parse data["dueAt"] unless data["dueAt"].nil? @status = data["status"] @time = data["time"] @estimate = data["estimate"] @attributes = data["attributes"] @metrics = data["metrics"] @unbillable = data["unbillable"] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def attributes @attributes end |
#description ⇒ Object
Returns the value of attribute description.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def description @description end |
#dueAt ⇒ Object
Returns the value of attribute dueAt.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def dueAt @dueAt end |
#estimate ⇒ Object
Returns the value of attribute estimate.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def estimate @estimate end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def id @id end |
#labels ⇒ Object
Returns the value of attribute labels.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def labels @labels end |
#metrics ⇒ Object
Returns the value of attribute metrics.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def metrics @metrics end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def position @position end |
#project_ids ⇒ Object
Returns the value of attribute project_ids.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def project_ids @project_ids end |
#section ⇒ Object
Returns the value of attribute section.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def section @section end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def status @status end |
#tags ⇒ Object
Returns the value of attribute tags.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def @tags end |
#time ⇒ Object
Returns the value of attribute time.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def time @time end |
#unbillable ⇒ Object
Returns the value of attribute unbillable.
7 8 9 |
# File 'lib/all_hours/task.rb', line 7 def unbillable @unbillable end |
Class Method Details
.find(api:, task_id:) ⇒ Object
42 43 44 45 |
# File 'lib/all_hours/task.rb', line 42 def self.find api:, task_id: data = api.api_call path: "tasks/#{task_id}" Task.new api: api, data: data end |
.search(api:, limit: 100, query: nil, searchInClosed: false) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/all_hours/task.rb', line 47 def self.search api:, limit: 100, query: nil, searchInClosed: false data = api.api_call(path: "tasks/search", query: {limit: limit, query: query, searchInClosed: searchInClosed}) tasks = [] data.each do |task_data| tasks << Task.new(api: api, data: task_data) end tasks end |