class Todoist::Sync::Filters

Public Instance Methods

add(args) click to toggle source

Add a filter with a given hash of attributes and returns the filter id.

Please note that item_id is required as is a date as specific in the documentation. This method can be tricky to all.

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

Return a Hash of filters where key is the id of a filter and value is a filter

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

Delete filter given an array of filters

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

Update a filter given a hash of attributes

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

Update orders for an array of filters

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