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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 648c3666c46b3a7ef72d0edfc6306d9aecae4b92
4
- data.tar.gz: afb4b3bb50d6e73e3188bdf9d876c7115062001c
3
+ metadata.gz: eac5739dcfe18e26d40bee0c707b38f060aae583
4
+ data.tar.gz: 51aa4575c9249b0d3129217e66a376ea86ff5a4b
5
5
  SHA512:
6
- metadata.gz: 718bfc80548f7dbf99ed0684adf3d1c5604baa13422c5a7d56325020d58589f00d94eed32865572a9f8fb16eeda91884e6da8913a53e2467c97440fc106cd61e
7
- data.tar.gz: a8a6340e339575451e9c4173469b23179337004dfe5f266b46920924d61eae08f03fb1d28518aa2b1abb2931e6313ea8e3485f8a4106c00d943a27f49c9e7bf5
6
+ metadata.gz: a5c0beb9e3e50fdb1e3212090856999e0bec3733a3909d78411b8e291580354bc5dfe64f9304c00a1107827266e76e1e116e5dd9c36d530e1df2405298ac7b75
7
+ data.tar.gz: f422266dcbc9ed0506577bbceeaf80392c3b62df926d7f54894b258911a9579abcd5d68d47b648ce59ba982094319944d270c23d4c13ce9b3aec590f5bd659ed
@@ -1,6 +1,7 @@
1
1
  require 'teapi/version'
2
2
  require 'teapi/configuration'
3
3
  require 'teapi/documents'
4
+ require 'teapi/lists'
4
5
  require 'teapi/sender'
5
6
 
6
7
  module Teapi #:nodoc
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Teapi
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
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.5
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: 2014-12-24 00:00:00.000000000 Z
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