teapi 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/teapi.rb +1 -0
- data/lib/teapi/lists.rb +25 -0
- data/lib/teapi/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eac5739dcfe18e26d40bee0c707b38f060aae583
|
4
|
+
data.tar.gz: 51aa4575c9249b0d3129217e66a376ea86ff5a4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5c0beb9e3e50fdb1e3212090856999e0bec3733a3909d78411b8e291580354bc5dfe64f9304c00a1107827266e76e1e116e5dd9c36d530e1df2405298ac7b75
|
7
|
+
data.tar.gz: f422266dcbc9ed0506577bbceeaf80392c3b62df926d7f54894b258911a9579abcd5d68d47b648ce59ba982094319944d270c23d4c13ce9b3aec590f5bd659ed
|
data/lib/teapi.rb
CHANGED
data/lib/teapi/lists.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Teapi
|
2
|
+
# Manages lists
|
3
|
+
class Lists
|
4
|
+
# inserts the document ids into the start of the list
|
5
|
+
# @param type [String] the list's type
|
6
|
+
# @param list [String] the list to insert into
|
7
|
+
# @param ids [array] the ids, or single id, to insert
|
8
|
+
# @param optional truncate [bool] whether to truncate the existing list (replacing all the old ids with the new one)
|
9
|
+
def self.insert(type, list, ids, truncate = false)
|
10
|
+
ids = [ids] unless ids.is_a?(Array)
|
11
|
+
d = {type: type, list: list, truncate: truncate, ids: ids}
|
12
|
+
Teapi.post(:lists, Oj.dump(d, mode: :compat))
|
13
|
+
end
|
14
|
+
|
15
|
+
# deletes the document ids from the list
|
16
|
+
# @param type [String] the list's type
|
17
|
+
# @param list [String] the list to insert into
|
18
|
+
# @param optional ids [array] the ids, or single id, to insert (nil to delete all)
|
19
|
+
def self.delete(type, list, ids = nil)
|
20
|
+
ids = [ids] unless ids.is_a?(Array) || ids.nil?
|
21
|
+
d = {type: type, list: list, ids: ids}
|
22
|
+
Teapi.delete(:lists, Oj.dump(d, mode: :compat))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/teapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Seguin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/teapi.rb
|
49
49
|
- lib/teapi/configuration.rb
|
50
50
|
- lib/teapi/documents.rb
|
51
|
+
- lib/teapi/lists.rb
|
51
52
|
- lib/teapi/sender.rb
|
52
53
|
- lib/teapi/version.rb
|
53
54
|
homepage: http://www.teapi.io
|