Class: Todoist::Sync::Labels
- Inherits:
-
Todoist::Service
- Object
- Todoist::Service
- Todoist::Sync::Labels
- Includes:
- Util
- Defined in:
- lib/todoist/sync/labels.rb
Instance Method Summary collapse
-
#add(args) ⇒ Object
Add a label with a given hash of attributes and returns the label id.
-
#collection ⇒ Object
Return a Hash of labels where key is the id of a label and value is a label.
-
#delete(label) ⇒ Object
Delete a label given a label.
-
#update(args) ⇒ Object
Update label given a hash of attributes.
-
#update_multiple_orders(labels) ⇒ Object
Update orders for an array of labels.
Methods inherited from Todoist::Service
Constructor Details
This class inherits a constructor from Todoist::Service
Instance Method Details
#add(args) ⇒ Object
Add a label with a given hash of attributes and returns the label id
12 13 14 |
# File 'lib/todoist/sync/labels.rb', line 12 def add(args) return @client.api_helper.add(args, "label_add") end |
#collection ⇒ Object
Return a Hash of labels where key is the id of a label and value is a label
7 8 9 |
# File 'lib/todoist/sync/labels.rb', line 7 def collection return @client.api_helper.collection("labels") end |
#delete(label) ⇒ Object
Delete a label given a label
22 23 24 25 |
# 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) ⇒ Object
Update label given a hash of attributes
17 18 19 |
# File 'lib/todoist/sync/labels.rb', line 17 def update(args) return @client.api_helper.command(args, "label_update") end |
#update_multiple_orders(labels) ⇒ Object
Update orders for an array of labels
28 29 30 31 32 33 34 35 |
# 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 |