teapi 0.0.2 → 0.0.3

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: aef895c695574ed1e75b94afbd9b36566672e610
4
- data.tar.gz: 1fbb569bb6636b3dcdff77b01aa4fe029eb4a36b
3
+ metadata.gz: 35d6852fbee1e3842f870c98058b6a9a44e8e628
4
+ data.tar.gz: c0f199565bf9ea85bc6993ccb961c2b6fb45c522
5
5
  SHA512:
6
- metadata.gz: a5d5b294981dcb6f22d19f42f7a0708d040f108ea5b4ac473a272e468c33e556e53c7799e2fb8d9b5f65a22d865f870288e5632523374f0a9eb63a6f16a777b2
7
- data.tar.gz: 3f5d666191be1bfa30459f36aa232da24838554ae1762354359a8ceb0af96fcddcebe36019b9861ec25b4b558d63c1b4a8645667b36aed9e2528f40e74982f59
6
+ metadata.gz: 533a0e4be5f692d9bcec02fa24f660443be2772a18dcb46266d7bba0ac89de6b72e507ff007f37a6fecb0617cad3a3f7d6b4615f2187dd06f63044ef8b63405e
7
+ data.tar.gz: a31bb5bdc83ec8d14981b742b9caf638732fa82c3e53c713ac4bd36902324049efaed31953a1bfd2018b6102d133d6b77b68e12d23c1a187972cdbe1d6a54009
@@ -4,15 +4,21 @@ module Teapi
4
4
  # creates a new document belonging to the given type
5
5
  # @param type [String] the document's type
6
6
  # @param doc [Hash] document to create
7
- def self.create(type, doc)
8
- Teapi.post(:documents, Oj.dump({type: type, doc: doc}, mode: :compat))
7
+ # @param optional meta [Hash] meta data associated with the document
8
+ def self.create(type, doc, meta = nil)
9
+ d = {type: type, doc: doc}
10
+ d[:meta] = meta unless meta.nil?
11
+ Teapi.post(:documents, Oj.dump(d, mode: :compat))
9
12
  end
10
13
 
11
14
  # updates the document belonging to the given type
12
15
  # @param type [String] the document's type
13
16
  # @param doc [Hash] the document to update
14
- def self.update(type, doc)
15
- Teapi.put(:documents, Oj.dump({type: type, doc: doc}, mode: :compat))
17
+ # @param optional meta [Hash] meta data associated with the document
18
+ def self.update(type, doc, meta = nil)
19
+ d = {type: type, doc: doc}
20
+ d[:meta] = meta unless meta.nil?
21
+ Teapi.put(:documents, Oj.dump(d, mode: :compat))
16
22
  end
17
23
 
18
24
  # deletes the document, by its id, belonging to the given type
@@ -1,3 +1,3 @@
1
1
  module Teapi
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
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.2
4
+ version: 0.0.3
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-17 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty