Class: Teapi::Lists
- Inherits:
-
Object
- Object
- Teapi::Lists
- Defined in:
- lib/teapi/lists.rb
Overview
Manages lists
Class Method Summary collapse
-
.delete(type, list, ids = nil) ⇒ Object
deletes the document ids from the list.
-
.insert(type, list, ids, truncate = false) ⇒ Object
inserts the document ids into the start of the list.
Class Method Details
.delete(type, list, ids = nil) ⇒ Object
deletes the document ids from the list
19 20 21 22 23 |
# File 'lib/teapi/lists.rb', line 19 def self.delete(type, list, ids = nil) ids = [ids] unless ids.is_a?(Array) || ids.nil? d = {type: type, list: list, ids: ids} Teapi.delete(:lists, Oj.dump(d, mode: :compat)) end |
.insert(type, list, ids, truncate = false) ⇒ Object
inserts the document ids into the start of the list
9 10 11 12 13 |
# File 'lib/teapi/lists.rb', line 9 def self.insert(type, list, ids, truncate = false) ids = [ids] unless ids.is_a?(Array) d = {type: type, list: list, truncate: truncate, ids: ids} Teapi.post(:lists, Oj.dump(d, mode: :compat)) end |