Class: Nin::Integration::Service::Todoist::Project
Instance Method Summary
collapse
#initialize
Instance Method Details
#add(project) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/nin/integration/service/todoist.rb', line 21
def add(project)
commands = [
{
"type": "project_add",
"temp_id": SecureRandom.uuid,
"uuid": SecureRandom.uuid,
"args": project
}
].to_json
@client.sync.write_resources(commands).fetch('temp_id_mapping').values.first
end
|
14
15
16
17
18
19
|
# File 'lib/nin/integration/service/todoist.rb', line 14
def all
@client
.sync
.read_resources(['projects'])
.fetch('projects').reduce({}) { |projects, p| projects.update(p["id"] => p["name"]) }
end
|