search_flip 3.0.0.beta5 → 3.1.2

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
  SHA256:
3
- metadata.gz: 4fae82bf67967306afbb6bfb0f2f321b8993fa364710b24dc7b3860f2bb6ace0
4
- data.tar.gz: a060faa2ea3b06233dc132b65df0e4c2bc18ab51ea5cfe92eadd96aaa7c8ddbf
3
+ metadata.gz: 51aeb6ec190e4ee6ff8d291d46e038e55bec7eb2b09cfc5eb410b9f523b75f8a
4
+ data.tar.gz: 89882033f77adf5c29104ae35e5c0ee2fd4d4222111ba98ad76cfb508a92da8d
5
5
  SHA512:
6
- metadata.gz: 15aa25cab455dfadead099deb59594580f9c09f71476818f28d483a7d7e8cb3decfd7c4126ecfaf438b92ed19ded8edfe01566d4cffcd1a03394608b66db9ebb
7
- data.tar.gz: 3a57bc2cecc98641c32f33c688576c7c808482bde3e3f9901590c7241102ef8a01d22f1dd875bd56d60c32fc9d38d4f97fd95e2f54249ccb2699c1ddc35a1e06
6
+ metadata.gz: 5fd5f110807947f0a1bc9906ced03be0c20a1c79a792321cd472d24b0c50a68e6ed88927f1db087ce64f45fd1544d85a5b434b25365f90f2ef83f9d06a8cb6db
7
+ data.tar.gz: cf8e8c77ec27b895249d39e8498207f4a4484776d9f3aefb79f163f5c9e262c80516e4ff99573e833f83ad1de96659a1b2707c1ae7d2786bd72d5d59631ba00b
@@ -1,5 +1,12 @@
1
1
  AllCops:
2
2
  NewCops: enable
3
+ TargetRubyVersion: 2.4
4
+
5
+ Gemspec/RequiredRubyVersion:
6
+ Enabled: false
7
+
8
+ Style/ExplicitBlockArgument:
9
+ Enabled: false
3
10
 
4
11
  Style/HashTransformValues:
5
12
  Enabled: false
@@ -5,9 +5,11 @@ env:
5
5
  - ES_IMAGE=elasticsearch:5.4
6
6
  - ES_IMAGE=docker.elastic.co/elasticsearch/elasticsearch:6.7.0
7
7
  - ES_IMAGE=docker.elastic.co/elasticsearch/elasticsearch:7.0.0
8
- - ES_IMAGE=docker.elastic.co/elasticsearch/elasticsearch:7.6.0
8
+ - ES_IMAGE=docker.elastic.co/elasticsearch/elasticsearch:7.9.0
9
9
  rvm:
10
+ - ruby-2.5.3
10
11
  - ruby-2.6.2
12
+ - ruby-2.7.1
11
13
  before_install:
12
14
  - docker-compose up -d
13
15
  - sleep 10
@@ -1,6 +1,20 @@
1
1
 
2
2
  # CHANGELOG
3
3
 
4
+ ## v3.1.2
5
+
6
+ * Fix ignored false value for source when merging criterias
7
+
8
+ ## v3.1.1
9
+
10
+ * Make `SearchFlip::Result.from_hit` work with the `_source` being disabled
11
+
12
+ ## v3.1.0
13
+
14
+ * Added plugin support in `SearchFlip::HTTPClient`
15
+ * Added `SearchFlip::AwsSigv4Plugin` to be able to use AWS Elasticsearch with
16
+ signed requests
17
+
4
18
  ## v3.0.0
5
19
 
6
20
  * Added `Criteria#to_query`, which returns a raw query including all queries
@@ -25,6 +39,10 @@
25
39
  `highlight` to aggregations
26
40
  * Added support for instrumentation
27
41
 
42
+ ## v2.3.2
43
+
44
+ * Remove ruby 2.7 warnings
45
+
28
46
  ## v2.3.1
29
47
 
30
48
  * Make `search_flip` work with hashie 4.0.0
data/README.md CHANGED
@@ -475,8 +475,8 @@ end
475
475
  ```
476
476
 
477
477
  Generally, aggregation results returned by Elasticsearch are returned as a
478
- `SearchFlip::Result`, which basically is `Hashie::Mash`such that you can access
479
- them via:
478
+ `SearchFlip::Result`, which basically is a `Hashie::Mash`, such that you can
479
+ access them via:
480
480
 
481
481
  ```ruby
482
482
  query.aggregations(:username)["mrkamel"].revenue.value
@@ -769,6 +769,41 @@ http_client = http_client.headers(key: "value")
769
769
  SearchFlip::Connection.new(base_url: "...", http_client: http_client)
770
770
  ```
771
771
 
772
+ ## AWS Elasticsearch / Signed Requests
773
+
774
+ To use SearchFlip with AWS Elasticsearch and signed requests, you have to add
775
+ `aws-sdk-core` to your Gemfile and tell SearchFlip to use the
776
+ `SearchFlip::AwsSigv4Plugin`:
777
+
778
+ ```ruby
779
+ require "search_flip/aws_sigv4_plugin"
780
+
781
+ MyConnection = SearchFlip::Connection.new(
782
+ base_url: "https://your-elasticsearch-cluster.es.amazonaws.com",
783
+ http_client: SearchFlip::HTTPClient.new(
784
+ plugins: [
785
+ SearchFlip::AwsSigv4Plugin.new(
786
+ region: "...",
787
+ access_key_id: "...",
788
+ secret_access_key: "..."
789
+ )
790
+ ]
791
+ )
792
+ )
793
+ ```
794
+
795
+ Again, in your index you need to specify this connection:
796
+
797
+ ```ruby
798
+ class MyIndex
799
+ include SearchFlip::Index
800
+
801
+ def self.connection
802
+ MyConnection
803
+ end
804
+ end
805
+ ```
806
+
772
807
  ## Routing and other index-time options
773
808
 
774
809
  Override `index_options` in case you want to use routing or pass other
@@ -914,6 +949,10 @@ It uses `after_commit` (if applicable, `after_save`, `after_destroy` and
914
949
  `after_touch` otherwise) hooks to synchronously update the index when your
915
950
  model changes.
916
951
 
952
+ ## Semantic Versioning
953
+
954
+ SearchFlip is using Semantic Versioning: [SemVer](http://semver.org/)
955
+
917
956
  ## Links
918
957
 
919
958
  * Elasticsearch: [https://www.elastic.co/](https://www.elastic.co/)
@@ -945,5 +984,4 @@ $ rspec
945
984
 
946
985
  That's it.
947
986
 
948
-
949
987
  [Bulk API]: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
@@ -1,3 +1,4 @@
1
+ require "ruby2_keywords"
1
2
  require "forwardable"
2
3
  require "http"
3
4
  require "hashie"
@@ -38,6 +39,8 @@ module SearchFlip
38
39
  attr_reader :code, :body
39
40
 
40
41
  def initialize(code:, body:)
42
+ super
43
+
41
44
  @code = code
42
45
  @body = body
43
46
  end
@@ -40,7 +40,7 @@ module SearchFlip
40
40
  else
41
41
  filters = (filter_values || []) + (must_not_values || []).map { |must_not_value| { not: must_not_value } }
42
42
  queries = must_values ? { must: must_values } : {}
43
- filters_and_queries = filters + (queries.size > 0 ? [bool: queries] : [])
43
+ filters_and_queries = filters + (queries.size > 0 ? [{ bool: queries }] : [])
44
44
 
45
45
  res[:filter] = filters_and_queries.size > 1 ? { and: filters_and_queries } : filters_and_queries.first
46
46
  end
@@ -101,7 +101,7 @@ module SearchFlip
101
101
  end
102
102
 
103
103
  def respond_to_missing?(name, *args)
104
- target.respond_to?(name, *args)
104
+ target.respond_to?(name, *args) || super
105
105
  end
106
106
 
107
107
  def method_missing(name, *args, &block)
@@ -112,6 +112,8 @@ module SearchFlip
112
112
  end
113
113
  end
114
114
 
115
+ ruby2_keywords :method_missing
116
+
115
117
  # @api private
116
118
  #
117
119
  # Simply dups the object for api compatability.
@@ -0,0 +1,47 @@
1
+ require "aws-sdk-core"
2
+ require "uri"
3
+
4
+ module SearchFlip
5
+ # The SearchFlip::AwsSigV4Plugin is a plugin for the SearchFlip::HTTPClient
6
+ # to be used with AWS Elasticsearch to sign requests, i.e. add signed
7
+ # headers, before sending the request to Elasticsearch.
8
+ #
9
+ # @example
10
+ # MyConnection = SearchFlip::Connection.new(
11
+ # base_url: "https://your-elasticsearch-cluster.es.amazonaws.com",
12
+ # http_client: SearchFlip::HTTPClient.new(
13
+ # plugins: [
14
+ # SearchFlip::AwsSigv4Plugin.new(
15
+ # region: "...",
16
+ # access_key_id: "...",
17
+ # secret_access_key: "..."
18
+ # )
19
+ # ]
20
+ # )
21
+ # )
22
+
23
+ class AwsSigv4Plugin
24
+ attr_accessor :signer
25
+
26
+ def initialize(options = {})
27
+ self.signer = Aws::Sigv4::Signer.new({ service: "es" }.merge(options))
28
+ end
29
+
30
+ def call(request, method, uri, options = {})
31
+ full_uri = URI.parse(uri)
32
+ full_uri.query = URI.encode_www_form(options[:params]) if options[:params]
33
+
34
+ signature_request = {
35
+ http_method: method.to_s.upcase,
36
+ url: full_uri.to_s
37
+ }
38
+
39
+ signature_request[:body] = options[:body] if options.key?(:body)
40
+ signature_request[:body] = options[:json].respond_to?(:to_str) ? options[:json] : JSON.generate(options[:json]) if options[:json]
41
+
42
+ signature = signer.sign_request(signature_request)
43
+
44
+ request.headers(signature.headers)
45
+ end
46
+ end
47
+ end
@@ -77,7 +77,7 @@ module SearchFlip
77
77
  # and versioning
78
78
 
79
79
  def index(id, object, options = {})
80
- perform :index, id, SearchFlip::JSON.generate(object), options
80
+ perform(:index, id, SearchFlip::JSON.generate(object), options)
81
81
  end
82
82
 
83
83
  # @api private
@@ -86,7 +86,7 @@ module SearchFlip
86
86
  #
87
87
  # @see #index
88
88
 
89
- def import(*args)
89
+ ruby2_keywords def import(*args)
90
90
  index(*args)
91
91
  end
92
92
 
@@ -100,7 +100,7 @@ module SearchFlip
100
100
  # and versioning
101
101
 
102
102
  def create(id, object, options = {})
103
- perform :create, id, SearchFlip::JSON.generate(object), options
103
+ perform(:create, id, SearchFlip::JSON.generate(object), options)
104
104
  end
105
105
 
106
106
  # @api private
@@ -113,7 +113,7 @@ module SearchFlip
113
113
  # and versioning
114
114
 
115
115
  def update(id, object, options = {})
116
- perform :update, id, SearchFlip::JSON.generate(object), options
116
+ perform(:update, id, SearchFlip::JSON.generate(object), options)
117
117
  end
118
118
 
119
119
  # @api private
@@ -125,7 +125,7 @@ module SearchFlip
125
125
  # and versioning
126
126
 
127
127
  def delete(id, options = {})
128
- perform :delete, id, nil, options
128
+ perform(:delete, id, nil, options)
129
129
  end
130
130
 
131
131
  private
@@ -44,35 +44,25 @@ module SearchFlip
44
44
  other = other.criteria
45
45
 
46
46
  fresh.tap do |criteria|
47
- criteria.profile_value = other.profile_value unless other.profile_value.nil?
48
- criteria.failsafe_value = other.failsafe_value unless other.failsafe_value.nil?
49
- criteria.terminate_after_value = other.terminate_after_value unless other.terminate_after_value.nil?
50
- criteria.timeout_value = other.timeout_value unless other.timeout_value.nil?
51
- criteria.offset_value = other.offset_value if other.offset_value
52
- criteria.limit_value = other.limit_value if other.limit_value
53
- criteria.scroll_args = other.scroll_args if other.scroll_args
54
- criteria.source_value = other.source_value if other.source_value
55
- criteria.preference_value = other.preference_value if other.preference_value
56
- criteria.search_type_value = other.search_type_value if other.search_type_value
57
- criteria.routing_value = other.routing_value if other.routing_value
58
- criteria.track_total_hits_value = other.track_total_hits_value unless other.track_total_hits_value.nil?
59
- criteria.explain_value = other.explain_value unless other.explain_value.nil?
60
-
61
- criteria.sort_values = (criteria.sort_values || []) + other.sort_values if other.sort_values
62
- criteria.includes_values = (criteria.includes_values || []) + other.includes_values if other.includes_values
63
- criteria.preload_values = (criteria.preload_values || []) + other.preload_values if other.preload_values
64
- criteria.eager_load_values = (criteria.eager_load_values || []) + other.eager_load_values if other.eager_load_values
65
- criteria.must_values = (criteria.must_values || []) + other.must_values if other.must_values
66
- criteria.must_not_values = (criteria.must_not_values || []) + other.must_not_values if other.must_not_values
67
- criteria.filter_values = (criteria.filter_values || []) + other.filter_values if other.filter_values
68
- criteria.post_must_values = (criteria.post_must_values || []) + other.post_must_values if other.post_must_values
69
- criteria.post_must_not_values = (criteria.post_must_not_values || []) + other.post_must_not_values if other.post_must_not_values
70
- criteria.post_filter_values = (criteria.post_filter_values || []) + other.post_filter_values if other.post_filter_values
71
-
72
- criteria.highlight_values = (criteria.highlight_values || {}).merge(other.highlight_values) if other.highlight_values
73
- criteria.suggest_values = (criteria.suggest_values || {}).merge(other.suggest_values) if other.suggest_values
74
- criteria.custom_value = (criteria.custom_value || {}).merge(other.custom_value) if other.custom_value
75
- criteria.aggregation_values = (criteria.aggregation_values || {}).merge(other.aggregation_values) if other.aggregation_values
47
+ [
48
+ :profile_value, :failsafe_value, :terminate_after_value, :timeout_value, :offset_value,
49
+ :limit_value, :scroll_args, :source_value, :preference_value, :search_type_value,
50
+ :routing_value, :track_total_hits_value, :explain_value
51
+ ].each do |name|
52
+ criteria.send(:"#{name}=", other.send(name)) unless other.send(name).nil?
53
+ end
54
+
55
+ [
56
+ :sort_values, :includes_values, :preload_values, :eager_load_values, :must_values,
57
+ :must_not_values, :filter_values, :post_must_values, :post_must_not_values,
58
+ :post_filter_values
59
+ ].each do |name|
60
+ criteria.send(:"#{name}=", (criteria.send(name) || []) + other.send(name)) if other.send(name)
61
+ end
62
+
63
+ [:highlight_values, :suggest_values, :custom_value, :aggregation_values].each do |name|
64
+ criteria.send(:"#{name}=", (criteria.send(name) || {}).merge(other.send(name))) if other.send(name)
65
+ end
76
66
  end
77
67
  end
78
68
 
@@ -206,7 +196,7 @@ module SearchFlip
206
196
  #
207
197
  # @return [SearchFlip::Criteria] Simply returns self
208
198
 
209
- def with_settings(*args)
199
+ ruby2_keywords def with_settings(*args)
210
200
  fresh.tap do |criteria|
211
201
  criteria.target = target.with_settings(*args)
212
202
  end
@@ -576,7 +566,7 @@ module SearchFlip
576
566
  end
577
567
 
578
568
  def respond_to_missing?(name, *args)
579
- target.respond_to?(name, *args)
569
+ target.respond_to?(name, *args) || super
580
570
  end
581
571
 
582
572
  def method_missing(name, *args, &block)
@@ -587,6 +577,8 @@ module SearchFlip
587
577
  end
588
578
  end
589
579
 
580
+ ruby2_keywords :method_missing
581
+
590
582
  def_delegators :response, :total_entries, :total_count, :current_page, :previous_page,
591
583
  :prev_page, :next_page, :first_page?, :last_page?, :out_of_range?, :total_pages,
592
584
  :hits, :ids, :count, :size, :length, :took, :aggregations, :suggestions,
@@ -34,9 +34,10 @@ module SearchFlip
34
34
  criteria.highlight_values = (criteria.highlight_values || {}).merge(options)
35
35
 
36
36
  hash =
37
- if fields.is_a?(Hash)
37
+ case fields
38
+ when Hash
38
39
  fields
39
- elsif fields.is_a?(Array)
40
+ when Array
40
41
  fields.each_with_object({}) { |field, h| h[field] = {} }
41
42
  else
42
43
  { fields => {} }
@@ -1,15 +1,14 @@
1
1
  module SearchFlip
2
- # @api private
3
- #
4
2
  # The SearchFlip::HTTPClient class wraps the http gem, is for internal use
5
3
  # and responsible for the http request/response handling, ie communicating
6
4
  # with Elasticsearch.
7
5
 
8
6
  class HTTPClient
9
- attr_accessor :request
7
+ attr_accessor :request, :plugins
10
8
 
11
- def initialize
9
+ def initialize(plugins: [])
12
10
  self.request = HTTP
11
+ self.plugins = plugins
13
12
  end
14
13
 
15
14
  class << self
@@ -25,18 +24,21 @@ module SearchFlip
25
24
  client.request = request.send(method, *args)
26
25
  end
27
26
  end
27
+
28
+ ruby2_keywords method
28
29
  end
29
30
 
30
31
  [:get, :post, :put, :delete, :head].each do |method|
31
- define_method method do |*args|
32
- execute(method, *args)
32
+ define_method(method) do |uri, options = {}|
33
+ execute(method, uri, options)
33
34
  end
34
35
  end
35
36
 
36
37
  private
37
38
 
38
- def execute(method, *args)
39
- response = request.send(method, *args)
39
+ def execute(method, uri, options = {})
40
+ final_request = plugins.inject(self) { |res, cur| cur.call(res, method, uri, options) }
41
+ response = final_request.request.send(method, uri, options)
40
42
 
41
43
  raise SearchFlip::ResponseError.new(code: response.code, body: response.body.to_s) unless response.status.success?
42
44
 
@@ -498,7 +498,7 @@ module SearchFlip
498
498
  #
499
499
  # @see #index See #index for more details
500
500
 
501
- def import(*args)
501
+ ruby2_keywords def import(*args)
502
502
  index(*args)
503
503
  end
504
504
 
@@ -222,7 +222,7 @@ module SearchFlip
222
222
  #
223
223
  # @return [Array] An array of database records
224
224
 
225
- def records(options = {})
225
+ def records
226
226
  @records ||= begin
227
227
  sort_map = ids.each_with_index.each_with_object({}) { |(id, index), hash| hash[id.to_s] = index }
228
228
 
@@ -17,7 +17,7 @@ module SearchFlip
17
17
  # SearchFlip::Result.from_hit(top_sales_hits.first)
18
18
 
19
19
  def self.from_hit(hit)
20
- raw_result = hit["_source"].dup
20
+ raw_result = (hit["_source"] || {}).dup
21
21
 
22
22
  raw_result["_hit"] = hit.each_with_object({}) do |(key, value), hash|
23
23
  hash[key] = value if key != "_source"
@@ -1,3 +1,3 @@
1
1
  module SearchFlip
2
- VERSION = "3.0.0.beta5"
2
+ VERSION = "3.1.2"
3
3
  end
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  MESSAGE
26
26
 
27
27
  spec.add_development_dependency "activerecord", ">= 3.0"
28
+ spec.add_development_dependency "aws-sdk-core"
28
29
  spec.add_development_dependency "bundler"
29
30
  spec.add_development_dependency "factory_bot"
30
31
  spec.add_development_dependency "rake"
@@ -37,4 +38,5 @@ Gem::Specification.new do |spec|
37
38
  spec.add_dependency "hashie"
38
39
  spec.add_dependency "http"
39
40
  spec.add_dependency "oj"
41
+ spec.add_dependency "ruby2_keywords"
40
42
  end
@@ -0,0 +1,41 @@
1
+ require File.expand_path("../spec_helper", __dir__)
2
+ require "search_flip/aws_sigv4_plugin"
3
+
4
+ RSpec.describe SearchFlip::AwsSigv4Plugin do
5
+ describe "#call" do
6
+ subject(:plugin) do
7
+ SearchFlip::AwsSigv4Plugin.new(
8
+ region: "us-east-1",
9
+ access_key_id: "access key",
10
+ secret_access_key: "secret access key"
11
+ )
12
+ end
13
+
14
+ let(:client) { SearchFlip::HTTPClient.new }
15
+
16
+ it "adds the signed headers to the request" do
17
+ Timecop.freeze Time.parse("2020-01-01 12:00:00 UTC") do
18
+ expect(client).to receive(:headers).with(
19
+ "host" => "localhost",
20
+ "authorization" => /.*/,
21
+ "x-amz-content-sha256" => /.*/,
22
+ "x-amz-date" => /20200101T120000Z/
23
+ )
24
+
25
+ plugin.call(client, :get, "http://localhost/index")
26
+ end
27
+ end
28
+
29
+ it "feeds the http method, full url and body to the signer" do
30
+ signing_request = {
31
+ http_method: "GET",
32
+ url: "http://localhost/index?param=value",
33
+ body: JSON.generate(key: "value")
34
+ }
35
+
36
+ expect(plugin.signer).to receive(:sign_request).with(signing_request).and_call_original
37
+
38
+ plugin.call(client, :get, "http://localhost/index", params: { param: "value" }, json: { key: "value" })
39
+ end
40
+ end
41
+ end
@@ -36,10 +36,10 @@ RSpec.describe SearchFlip::Connection do
36
36
  it "changes the aliases" do
37
37
  connection = SearchFlip::Connection.new
38
38
 
39
- connection.update_aliases(actions: [add: { index: "products", alias: "alias1" }])
39
+ connection.update_aliases(actions: [{ add: { index: "products", alias: "alias1" } }])
40
40
  expect(connection.get_aliases(alias_name: "alias1").keys).to eq(["products"])
41
41
 
42
- connection.update_aliases(actions: [remove: { index: "products", alias: "alias1" }])
42
+ connection.update_aliases(actions: [{ remove: { index: "products", alias: "alias1" } }])
43
43
  expect(connection.alias_exists?("alias1")).to eq(false)
44
44
  end
45
45
  end
@@ -79,11 +79,11 @@ RSpec.describe SearchFlip::Connection do
79
79
 
80
80
  expect(connection.alias_exists?(:some_alias)).to eq(false)
81
81
 
82
- connection.update_aliases(actions: [add: { index: "products", alias: "some_alias" }])
82
+ connection.update_aliases(actions: [{ add: { index: "products", alias: "some_alias" } }])
83
83
 
84
84
  expect(connection.alias_exists?(:some_alias)).to eq(true)
85
85
  ensure
86
- connection.update_aliases(actions: [remove: { index: "products", alias: "some_alias" }])
86
+ connection.update_aliases(actions: [{ remove: { index: "products", alias: "some_alias" } }])
87
87
  end
88
88
  end
89
89
  end
@@ -110,6 +110,16 @@ RSpec.describe SearchFlip::Criteria do
110
110
 
111
111
  expect(criteria1.merge(criteria2).send(method)).to eq("value2")
112
112
  end
113
+
114
+ it "handles false values correctly" do
115
+ criteria1 = SearchFlip::Criteria.new(target: TestIndex)
116
+ criteria1.send("#{method}=", true)
117
+
118
+ criteria2 = SearchFlip::Criteria.new(target: TestIndex)
119
+ criteria2.send("#{method}=", false)
120
+
121
+ expect(criteria1.merge(criteria2).send(method)).to eq(false)
122
+ end
113
123
  end
114
124
  end
115
125
 
@@ -39,6 +39,23 @@ RSpec.describe SearchFlip::HTTPClient do
39
39
  end
40
40
  end
41
41
 
42
+ describe "plugins" do
43
+ subject do
44
+ SearchFlip::HTTPClient.new(
45
+ plugins: [
46
+ ->(request, _method, _uri, _options = {}) { request.headers("First-Header" => "Value") },
47
+ ->(request, _method, _uri, _options = {}) { request.headers("Second-Header" => "Value") }
48
+ ]
49
+ )
50
+ end
51
+
52
+ it "injects the plugins and uses their result in the request" do
53
+ stub_request(:get, "http://localhost/path").with(query: { key: "value" }, headers: { "First-Header" => "Value", "Second-Header" => "Value" }).and_return(body: "success")
54
+
55
+ expect(subject.get("http://localhost/path", params: { key: "value" }).body.to_s).to eq("success")
56
+ end
57
+ end
58
+
42
59
  [:via, :basic_auth, :auth].each do |method|
43
60
  describe "##{method}" do
44
61
  it "creates a dupped instance" do
@@ -13,5 +13,11 @@ RSpec.describe SearchFlip::Result do
13
13
 
14
14
  expect(result.key1[0].key2).to eq("value")
15
15
  end
16
+
17
+ it "works with the _source being disabled" do
18
+ result = SearchFlip::Result.from_hit("_id" => 1)
19
+
20
+ expect(result._hit._id).to eq(1)
21
+ end
16
22
  end
17
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_flip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta5
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Vetter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +192,20 @@ dependencies:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: ruby2_keywords
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
181
209
  description: Full-Featured Elasticsearch Ruby Client with a Chainable DSL
182
210
  email:
183
211
  - vetter@flakks.com
@@ -198,6 +226,7 @@ files:
198
226
  - lib/search_flip.rb
199
227
  - lib/search_flip/aggregatable.rb
200
228
  - lib/search_flip/aggregation.rb
229
+ - lib/search_flip/aws_sigv4_plugin.rb
201
230
  - lib/search_flip/bulk.rb
202
231
  - lib/search_flip/config.rb
203
232
  - lib/search_flip/connection.rb
@@ -224,6 +253,7 @@ files:
224
253
  - search_flip.gemspec
225
254
  - spec/delegate_matcher.rb
226
255
  - spec/search_flip/aggregation_spec.rb
256
+ - spec/search_flip/aws_sigv4_plugin_spec.rb
227
257
  - spec/search_flip/bulk_spec.rb
228
258
  - spec/search_flip/connection_spec.rb
229
259
  - spec/search_flip/criteria_spec.rb
@@ -253,9 +283,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
283
  version: '0'
254
284
  required_rubygems_version: !ruby/object:Gem::Requirement
255
285
  requirements:
256
- - - ">"
286
+ - - ">="
257
287
  - !ruby/object:Gem::Version
258
- version: 1.3.1
288
+ version: '0'
259
289
  requirements: []
260
290
  rubygems_version: 3.0.3
261
291
  signing_key:
@@ -264,6 +294,7 @@ summary: Full-Featured Elasticsearch Ruby Client with a Chainable DSL
264
294
  test_files:
265
295
  - spec/delegate_matcher.rb
266
296
  - spec/search_flip/aggregation_spec.rb
297
+ - spec/search_flip/aws_sigv4_plugin_spec.rb
267
298
  - spec/search_flip/bulk_spec.rb
268
299
  - spec/search_flip/connection_spec.rb
269
300
  - spec/search_flip/criteria_spec.rb