elasticsearch-persistence 0.1.8 → 0.1.9

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: 0e68271351dc49665d55b42ef03261773e0e0487
4
- data.tar.gz: 0062f28b76d0d5e73484b10ba4480e74b576efe4
3
+ metadata.gz: fa44968662509546e9ad4f6c0faad08a34ec95ad
4
+ data.tar.gz: f3402c6d0c02ad259dbc8a39d0afb1274aa73832
5
5
  SHA512:
6
- metadata.gz: 1610448416e545c6dc7ed1ce18760833fd0f48e3452ea9887762b303896c3dd7cd8ca28e71cff25ed9a9a6062d063944ecc06f8f7cd7483819a05665f7c06553
7
- data.tar.gz: 02df7217562efa1277489e1e8878fff983f509f5351d0533d2231154bc556829063a4e8369afddc0c3b722f505e46d59108f3220c1c49c83eb058ef89ab0d291
6
+ metadata.gz: 85b3dfbf241cf54b1c67d96b5cc2bfdb79cb4ec315d04fd908f56b6ed3b40f32c6b3adc6c72091f42a9dd52dde8652782774783d31fc4537d5024af4a7176552
7
+ data.tar.gz: 0cb3163aa6afa15846d83e2b1abda34a4ace6bba011c4120a2482a0e8bbb6e86484e2b6d429e1a14cab758bb42c6fb8483668089171608192f440dfb2f2e9611
@@ -1,3 +1,7 @@
1
+ ## 0.1.9
2
+
3
+ * Added, that raw `_source` is accessible from a model instance
4
+
1
5
  ## 0.1.8
2
6
 
3
7
  * Added `cluster.health wait_for_status: 'yellow'` to Repository integration test
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_dependency "virtus"
32
32
 
33
33
  s.add_development_dependency "bundler", "~> 1.5"
34
- s.add_development_dependency "rake"
34
+ s.add_development_dependency "rake", "< 11.0"
35
35
 
36
36
  s.add_development_dependency "oj"
37
37
 
@@ -108,6 +108,7 @@ module Elasticsearch
108
108
  object.instance_variable_set :@_index, document['_index']
109
109
  object.instance_variable_set :@_type, document['_type']
110
110
  object.instance_variable_set :@_version, document['_version']
111
+ object.instance_variable_set :@_source, document['_source']
111
112
 
112
113
  # Store the "hit" information (highlighting, score, ...)
113
114
  #
@@ -49,6 +49,12 @@ module Elasticsearch
49
49
  @_version
50
50
  end
51
51
 
52
+ # Return the raw document `_source`
53
+ #
54
+ def _source
55
+ @_source
56
+ end
57
+
52
58
  def to_s
53
59
  "#<#{self.class} #{attributes.to_hash.inspect.gsub(/:(\w+)=>/, '\1: ')}>"
54
60
  end; alias :inspect :to_s
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module Persistence
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
@@ -89,11 +89,13 @@ class Elasticsearch::Persistence::ModelGatewayTest < Test::Unit::TestCase
89
89
  assert DummyGatewayModel.gateway.deserialize('_id' => 'abc123', '_source' => {}).instance_variable_get(:@persisted)
90
90
  end
91
91
 
92
+ should "allow accessing the raw _source" do
93
+ assert_equal 'bar', DummyGatewayModel.gateway.deserialize('_source' => { 'foo' => 'bar' })._source['foo']
94
+ end
95
+
92
96
  should "allow to access the raw hit from results as Hashie::Mash" do
93
97
  assert_equal 0.42, DummyGatewayModel.gateway.deserialize('_score' => 0.42, '_source' => {}).hit._score
94
98
  end
95
99
 
96
-
97
-
98
100
  end
99
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-persistence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-12 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "<"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: '11.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "<"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: '11.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: oj
127
127
  requirement: !ruby/object:Gem::Requirement