elastic_record 3.1.3 → 3.1.4

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: 1539f24ad6321a28834405dafdfcefa3828f199c
4
- data.tar.gz: 1f3b102b792235592d0f4026d3d9e007f569fd59
3
+ metadata.gz: c59b1b2830ef2314166e53fed56b060628e31962
4
+ data.tar.gz: c88b89a8a5335502aa4cf0bb8b46fb477dcb8f4e
5
5
  SHA512:
6
- metadata.gz: e634439f433e50cd8fae20c32cfcbc2edab24e18d78fb4542afd1a66f244f366d0a6d7798ebecf8b20be947d2113deda2087c6cd3bebf6150139de96ff3ea74a
7
- data.tar.gz: 642794e9b9d678f51269327cc0ee671773a04aa1bdf716679f8f70b4c9cf4c5250a9d7f4c4417681228a4f6ed60e9af17aa37e79d0baa44e0bfb682df805f925
6
+ metadata.gz: '09c62833cc9bb4bc486b5b53d65ac1c0a2395129edd6fbe1f887a5e208e75a99e585d898b2c8e1661084268d48f1d6a836e92654dba5bb6de0cf812849f9d502'
7
+ data.tar.gz: 8948ebb21a69e0eaa17e51f2456a73f2d7cde27312cdb4d7c52c661742c4e8fbbfef7f8996d0d4e9e652e98f95ecfba0782e90bd2966ff2606a239b49426615c
data/.travis.yml CHANGED
@@ -1,16 +1,21 @@
1
- rvm: 2.3.1
1
+ rvm:
2
+ - 2.4.1
2
3
  cache: bundler
4
+ # Not using Trusty containers because of:
5
+ # https://github.com/travis-ci/travis-ci/issues/6842
3
6
  sudo: required
4
7
  dist: trusty
5
- before_install:
6
- - wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.2.2/elasticsearch-2.2.2.deb
7
- - sudo dpkg -i elasticsearch-2.2.2.deb
8
- - sudo service elasticsearch start
9
- - sudo apt-get install --yes mysql-server
8
+ addons:
9
+ apt:
10
+ sources:
11
+ - elasticsearch-2.x
12
+ packages:
13
+ - elasticsearch
10
14
  before_script:
11
15
  - cp test/dummy/.env.example test/dummy/.env
12
16
  - curl localhost:9200
13
17
  - bundle exec rake app:db:setup
14
18
  - bundle exec rake app:index:reset
15
19
  services:
20
+ - elasticsearch
16
21
  - postgresql
data/Gemfile CHANGED
@@ -3,8 +3,8 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'dotenv-rails'
6
- gem 'oj'
7
6
  gem 'mysql2'
7
+ gem 'oj'
8
8
  gem 'pg'
9
9
  gem 'rails'
10
10
  gem 'rake', '~> 10.5.0'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '3.1.3'
5
+ s.version = '3.1.4'
6
6
  s.summary = 'An Elasticsearch querying ORM'
7
7
  s.description = 'Find your records with Elasticsearch'
8
8
 
@@ -45,7 +45,7 @@ module ElasticRecord
45
45
  end
46
46
  end
47
47
 
48
- amend_partial_update_document(json) if respond_to?(:partial_update_document)
48
+ amend_partial_update_document(json) if respond_to?(:amend_partial_update_document)
49
49
 
50
50
  json
51
51
  end
@@ -103,9 +103,11 @@ module ElasticRecord
103
103
  self.request_count = 0
104
104
  end
105
105
 
106
- host, port = current_server.split ':'
106
+ server = current_server.start_with?('http') ? current_server : "http://#{current_server}"
107
+ uri = URI(server)
107
108
 
108
- http = Net::HTTP.new(host, port)
109
+ http = Net::HTTP.new(uri.host, uri.port)
110
+ http.use_ssl = uri.scheme == 'https'
109
111
  if options[:timeout]
110
112
  http.read_timeout = options[:timeout].to_i
111
113
  end
@@ -8,8 +8,12 @@ module ElasticRecord
8
8
  end
9
9
 
10
10
  def create(index_name = new_index_name)
11
- connection.json_put "/#{index_name}", "settings" => settings
12
- update_mapping(index_name)
11
+ connection.json_put "/#{index_name}", {
12
+ "mappings" => {
13
+ type => mapping
14
+ },
15
+ "settings" => settings
16
+ }
13
17
  index_name
14
18
  end
15
19
 
@@ -19,7 +19,7 @@ module ElasticRecord
19
19
 
20
20
  def encode(data)
21
21
  if ElasticRecord::JSON.parser == :oj
22
- Oj.dump(data, mode: :compat)
22
+ Oj.dump(data, mode: :compat, use_as_json: true)
23
23
  else
24
24
  ActiveSupport::JSON.encode(data)
25
25
  end
@@ -9,7 +9,7 @@ module ElasticRecord
9
9
 
10
10
  def find_in_batches(options = {})
11
11
  find_ids_in_batches(options) do |ids|
12
- yield klass.find(ids)
12
+ yield klass.where(id: ids)
13
13
  end
14
14
  end
15
15
 
@@ -17,6 +17,10 @@ module TestModel
17
17
  ids.map { |id| new(id: id) }
18
18
  end
19
19
 
20
+ def where(query)
21
+ find query[:id]
22
+ end
23
+
20
24
  def primary_key
21
25
  'id'
22
26
  end
@@ -18,9 +18,6 @@ module Dummy
18
18
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
19
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
20
  # config.i18n.default_locale = :de
21
-
22
- # Do not swallow errors in after_commit/after_rollback callbacks.
23
- config.active_record.raise_in_transactional_callbacks = true
24
21
  end
25
22
  end
26
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infogroup
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-08-10 00:00:00.000000000 Z
12
+ date: 2017-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: 1.8.11
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.5.1
189
+ rubygems_version: 2.6.11
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: An Elasticsearch querying ORM