class Todoist::Sync::Labels

Public Instance Methods

add(args) click to toggle source

Add a label with a given hash of attributes and returns the label id

# File lib/todoist/sync/labels.rb, line 12
def add(args)
  return @client.api_helper.add(args, "label_add")
end
collection() click to toggle source

Return a Hash of labels where key is the id of a label and value is a label

# File lib/todoist/sync/labels.rb, line 7
def collection
  return @client.api_helper.collection("labels")
end
delete(label) click to toggle source

Delete a label given a label

# File lib/todoist/sync/labels.rb, line 22
def delete(label)
  args = {id: label.id}
  return @client.api_helper.command(args, "label_delete")
end
update(args) click to toggle source

Update label given a hash of attributes

# File lib/todoist/sync/labels.rb, line 17
def update(args)
  return @client.api_helper.command(args, "label_update")
end
update_multiple_orders(labels) click to toggle source

Update orders for an array of labels

# File lib/todoist/sync/labels.rb, line 28
def update_multiple_orders(labels)
  args = {}
  labels.each do |label|
    args[label.id] = label.item_order
  end
  args = {id_order_mapping: args.to_json}
  return @client.api_helper.command(args, "label_update_orders")
end