elastic_record 1.4.0 → 1.4.1

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: 40c1bffc2887b7c0b7ae0b3ea42ae93178d4e61e
4
- data.tar.gz: 4b4658f4227ae0539c5b1ff0ac57e7e53349e28c
3
+ metadata.gz: 89d2ef3fed887aeb688bfb24abb83eec1145edf1
4
+ data.tar.gz: c7463026231a8da26cc18bb64f3ab0bebb46cfd1
5
5
  SHA512:
6
- metadata.gz: 1b5ea2655c94daac6272995fa88ce1c7c065d1d640fbb8ab88866c4e660f82c7ac431404b365ba2c86449491390b5dd975832f3186c10220ceaeb0a2b810f696
7
- data.tar.gz: 7ec011ac6c1395bacb6bc4336a28d6603313e8549727d0ecf729164271ab10fe91dfd225fe7b8066ffcc10200e77006135abe7a474b4c37cccab9405c5802197
6
+ metadata.gz: 00d8772ca376b519a7c561330be588339280284ef38364c4866c06e9e16a58255cfd7c2aaff60f8354b8c6273665e5912abed18555e74c3e9d3594c4eeec1ac4
7
+ data.tar.gz: be481f2c74f15b62a62c0dac84fd3dac654f9719340338e2b99a69f44dcb85601dd7a99a08c6c182cb6bea62d9776174c592f66fb98ec3d3e079fa29c20b67e4
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'elastic_record'
5
- s.version = '1.4.0'
5
+ s.version = '1.4.1'
6
6
  s.summary = 'Use Elastic Search with your objects'
7
7
  s.description = 'Find your records with elastic search'
8
8
 
@@ -46,18 +46,9 @@ module ElasticRecord
46
46
  json
47
47
  end
48
48
 
49
- METHODS = {
50
- head: Net::HTTP::Head,
51
- get: Net::HTTP::Get,
52
- post: Net::HTTP::Post,
53
- put: Net::HTTP::Put,
54
- delete: Net::HTTP::Delete
55
- }
56
-
57
49
  def http_request(method, path, body = nil)
58
50
  with_retry do
59
- request = METHODS[method].new(path)
60
- request.body = body
51
+ request = new_request(method, path, body)
61
52
  http = new_http
62
53
 
63
54
  ActiveSupport::Notifications.instrument("request.elastic_record") do |payload|
@@ -68,7 +59,22 @@ module ElasticRecord
68
59
  end
69
60
  end
70
61
 
62
+ METHODS = {
63
+ head: Net::HTTP::Head,
64
+ get: Net::HTTP::Get,
65
+ post: Net::HTTP::Post,
66
+ put: Net::HTTP::Put,
67
+ delete: Net::HTTP::Delete
68
+ }
69
+ def new_request(method, path, body)
70
+ request = METHODS[method].new(path)
71
+ request.basic_auth(options[:username], options[:password]) if options[:username].present?
72
+ request.body = body
73
+ request
74
+ end
75
+
71
76
  private
77
+
72
78
  def next_server
73
79
  if @shuffled_servers.nil?
74
80
  @shuffled_servers = servers.shuffle
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: 1.4.0
4
+ version: 1.4.1
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: 2014-10-23 00:00:00.000000000 Z
12
+ date: 2014-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arelastic