Class: Dotloop::Tasklist

Inherits:
Object
  • Object
show all
Defined in:
lib/dotloop/tasklist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tasklist

Returns a new instance of Tasklist.



7
8
9
# File 'lib/dotloop/tasklist.rb', line 7

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/dotloop/tasklist.rb', line 5

def client
  @client
end

Instance Method Details

#all(profile_id:, loop_id:) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/dotloop/tasklist.rb', line 11

def all(profile_id:, loop_id:)
  @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/tasklist")[:data].map do |tasklist_attrs|
    tasklist = Dotloop::Models::Tasklist.new(tasklist_attrs)
    tasklist.client = client
    tasklist.profile_id = profile_id.to_i
    tasklist.loop_id = loop_id.to_i
    tasklist
  end
end

#find(profile_id:, loop_id:, task_list_id:) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/dotloop/tasklist.rb', line 21

def find(profile_id:, loop_id:, task_list_id:)
  tasklist_data = @client.get("/profile/#{profile_id.to_i}/loop/#{loop_id.to_i}/tasklist/#{task_list_id.to_i}")[:data]
  tasklist = Dotloop::Models::Tasklist.new(tasklist_data)
  tasklist.client = client
  tasklist.profile_id = profile_id.to_i
  tasklist.loop_id = loop_id.to_i
  tasklist
end