algoliasearch-rails 2.3.0 → 2.3.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
  SHA256:
3
- metadata.gz: 91a3c57ba564afcd15833841c0c4dad105b1889179281b43e59a1adcb5c3acd2
4
- data.tar.gz: d8bdac6cdf53cb6f095e1d485c6ceff1d94a17c6d649d76cefd29dca37d65172
3
+ metadata.gz: 6c936268f937121a58b8a141df1d9cb5dc25504ff4c25dc3e4d133060162d326
4
+ data.tar.gz: 8b2262430fc7edab858ce40e6f46638ceb65ddea27f17b2261e2251c93b725b3
5
5
  SHA512:
6
- metadata.gz: 13fe3ebce7b706de4324f0ee1f5fea8fdcfb6913445cc56a24a337868ac9f98edd173b5559a58921b73156d1dfe5d56fd3bd302666923966e5a1c4328369b5ec
7
- data.tar.gz: f6237c40c513bacdb78ebd307668c0ae478c4e20f600a5d9ac10ca164ab2082e9515d9061177e5b93faf9ffebafbe4c864f80851c9466ac23565f4a7dadc83b4
6
+ metadata.gz: b54ada522502ea04902a815a185d1c7ee016c121ca711a79db89815c3ebf443dd958b68d9b64c7ae48d6260bd423472234babc11c0e6d43f5f0f17793b601d67
7
+ data.tar.gz: 7ec62bbe246782b6015be92ec55cf680157116e974c88efc5300f528e7324a437b182e7c6e5cde640d18ae5671b0052fad75338a41ed54e0b307c6a1834eaf77
data/CHANGELOG.MD CHANGED
@@ -2,7 +2,12 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/2.2.1...master)
4
4
 
5
- ## [2.2.2](https://github.com/algolia/algoliasearch-rails/compare/2.2.2...2.3.0)
5
+ ## [2.3.1](https://github.com/algolia/algoliasearch-rails/compare/2.3.0...2.3.1)
6
+ ### Added
7
+ * Allow ActiveJob queue configuration [`#439`](https://github.com/algolia/algoliasearch-rails/pull/439)
8
+ * allow to configure user agent and other default options [`#438`](https://github.com/algolia/algoliasearch-rails/pull/438)
9
+
10
+ ## [2.3.0](https://github.com/algolia/algoliasearch-rails/compare/2.2.2...2.3.0)
6
11
  ### Fixed
7
12
  * bugfix: don't consider objectID changed when using custom ID through method [`#436`](https://github.com/algolia/algoliasearch-rails/pull/436)
8
13
 
@@ -1,6 +1,6 @@
1
1
  module AlgoliaSearch
2
2
  class AlgoliaJob < ::ActiveJob::Base
3
- queue_as :algoliasearch
3
+ queue_as { AlgoliaSearch.configuration[:queue_name] }
4
4
 
5
5
  def perform(record, method)
6
6
  record.send(method)
@@ -1,5 +1,10 @@
1
1
  module AlgoliaSearch
2
2
  module Configuration
3
+ REQUIRED_CONFIGURATION = {
4
+ user_agent: "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{defined?(::Rails::VERSION::STRING) ? ::Rails::VERSION::STRING : 'unknown'})",
5
+ symbolize_keys: false
6
+ }
7
+
3
8
  def initialize
4
9
  @client = nil
5
10
  end
@@ -9,10 +14,11 @@ module AlgoliaSearch
9
14
  end
10
15
 
11
16
  def configuration=(configuration)
12
- @@configuration = configuration.merge(
13
- :user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION::STRING})",
14
- :symbolize_keys => false
15
- )
17
+ user_agent = [REQUIRED_CONFIGURATION[:user_agent], configuration[:append_to_user_agent]].compact.join('; ')
18
+ @@configuration = default_configuration
19
+ .merge(configuration)
20
+ .merge(REQUIRED_CONFIGURATION)
21
+ .merge({ user_agent: user_agent })
16
22
  end
17
23
 
18
24
  def client_opts
@@ -34,5 +40,11 @@ module AlgoliaSearch
34
40
  def setup_client
35
41
  @client = Algolia::Search::Client.new(Algolia::Search::Config.new(@@configuration), client_opts)
36
42
  end
43
+
44
+ def default_configuration
45
+ {
46
+ queue_name: 'algoliasearch'
47
+ }
48
+ end
37
49
  end
38
50
  end
@@ -1,3 +1,3 @@
1
1
  module AlgoliaSearch
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -15,6 +15,8 @@ raise "missing ALGOLIA_APPLICATION_ID or ALGOLIA_API_KEY environment variables"
15
15
 
16
16
  Thread.current[:algolia_hosts] = nil
17
17
 
18
+ GlobalID.app = 'algoiasearch-rails'
19
+
18
20
  RSpec.configure do |c|
19
21
  c.mock_with :rspec
20
22
  c.filter_run :focus => true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-12 00:00:00.000000000 Z
11
+ date: 2023-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json