agnostic_backend 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3681b96c3c753d0e481a9c3199ae5ce88d4eedea
4
- data.tar.gz: 25c51fbdb76285b74282863c84d045823823f975
3
+ metadata.gz: b9ecddd77021dd8bfc5b236e98ee6c533d4a3cee
4
+ data.tar.gz: 21d2da7976e91897ebf8ea6a202e867a04c293c5
5
5
  SHA512:
6
- metadata.gz: 757260c91ff7009f04f5bba0199ba288d9e89739b90bf53092d37a7d268838e42923eef1cbc2fe92b83bc4cc6cb6a1b47ff59115bdb31990bce4245b855f0c18
7
- data.tar.gz: 0568a8328fde6338208469534d41a007ce42f8ee670c501dbedee4aafa40edcd8671f1bec84da5bf372e01e2ef4d466893ff1254a791907b1507cdcd5a4f2d3b
6
+ metadata.gz: 8a28655097b70ca8755051ab53998da1a627f76b8387eed09fdba110c597d555cacb4651488d5502317c18659dca4cae048d52ff44ac9afbeb0bb542f9f3f850
7
+ data.tar.gz: 6c56349203e3cfb3df20e3ad3746568e9802e29fc7b9685263eb13aed0991c5cd5f7c99ad15fbff4dddd7ec5e4733ceab94429dc90ee469331513555fa446764
@@ -22,7 +22,6 @@ module AgnosticBackend
22
22
  publish_all(documents)
23
23
  end
24
24
 
25
- private
26
25
 
27
26
  def publish(document)
28
27
  publish_all([document])
@@ -40,6 +39,8 @@ module AgnosticBackend
40
39
  end
41
40
  end
42
41
 
42
+ private
43
+
43
44
  def client
44
45
  index.cloudsearch_domain_client
45
46
  end
@@ -3,12 +3,6 @@ module AgnosticBackend
3
3
  class Indexer < AgnosticBackend::Indexer
4
4
  include AgnosticBackend::Utilities
5
5
 
6
- private
7
-
8
- def client
9
- index.client
10
- end
11
-
12
6
  def publish(document)
13
7
  client.send_request(:put,
14
8
  path: "/#{index.index_name}/#{index.type}/#{document["id"]}",
@@ -26,6 +20,11 @@ module AgnosticBackend
26
20
  response
27
21
  end
28
22
 
23
+ private
24
+
25
+ def client
26
+ index.client
27
+ end
29
28
 
30
29
  def prepare(document)
31
30
  raise IndexingError.new, "Document does not have an ID field" unless document["id"].present?
@@ -21,12 +21,18 @@ module AgnosticBackend
21
21
  # @param [Indexable] an Indexable object
22
22
  def put_all(indexables)
23
23
  documents = indexables.map do |indexable|
24
- transform(prepare(indexable.generate_document))
24
+ generate_document(indexable)
25
25
  end
26
26
  documents.reject!(&:empty?)
27
+
27
28
  publish_all(documents) unless documents.empty?
28
29
  end
29
30
 
31
+ # @param [Indexable] an Indexable object
32
+ def generate_document(indexable)
33
+ transform(prepare(indexable.generate_document))
34
+ end
35
+
30
36
  # Deletes the specified document from the index
31
37
  # @param [document_id] the document id of the indexed document
32
38
  def delete(document_id)
@@ -41,8 +47,6 @@ module AgnosticBackend
41
47
  raise NotImplementedError
42
48
  end
43
49
 
44
- private
45
-
46
50
  def publish(document)
47
51
  publish_all([document])
48
52
  end
@@ -51,6 +55,8 @@ module AgnosticBackend
51
55
  raise NotImplementedError
52
56
  end
53
57
 
58
+ private
59
+
54
60
  def transform(document)
55
61
  raise NotImplementedError
56
62
  end
@@ -1,3 +1,3 @@
1
1
  module AgnosticBackend
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agnostic_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iasonas Gavriilidis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-10-19 00:00:00.000000000 Z
13
+ date: 2016-10-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport