Class: Dotloop::Task
- Inherits:
-
Object
- Object
- Dotloop::Task
- Defined in:
- lib/dotloop/task.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #all(profile_id:, loop_id:, task_list_id:) ⇒ Object
- #find(profile_id:, loop_id:, task_list_id:, task_id:) ⇒ Object
-
#initialize(client:) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(client:) ⇒ Task
Returns a new instance of Task.
7 8 9 |
# File 'lib/dotloop/task.rb', line 7 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/dotloop/task.rb', line 5 def client @client end |
Instance Method Details
#all(profile_id:, loop_id:, task_list_id:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dotloop/task.rb', line 11 def all(profile_id:, loop_id:, task_list_id:) @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/tasklist/#{task_list_id.to_i}/task")[:data].map do |task_attrs| task = Dotloop::Models::Task.new(task_attrs) task.client = client task.profile_id = profile_id.to_i task.loop_id = loop_id.to_i task.task_list_id = task_list_id.to_i task end end |
#find(profile_id:, loop_id:, task_list_id:, task_id:) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/dotloop/task.rb', line 22 def find(profile_id:, loop_id:, task_list_id:, task_id:) task_data = @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/tasklist/#{task_list_id.to_i}/task/#{task_id.to_i}")[:data] task = Dotloop::Models::Task.new(task_data) task.client = client task.profile_id = profile_id.to_i task.loop_id = loop_id.to_i task.task_list_id = task_list_id.to_i task end |