ndb-rails 1.17.2 → 1.18.1

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: 7f752970fc32a5101c8ce4d8d9b683959fbffbedb87df33488a499eef78377a3
4
- data.tar.gz: a569eade35c1c348798234978ddd18d9f6f4e4da7cead6f3f3bb46a13e0518cf
3
+ metadata.gz: 5c52f71f60b8a66bc19277f960b4ed2a41d1231c9ee46a855dc11ab1a6be4034
4
+ data.tar.gz: c03234cd46b88aed4c3b67fafb3162681c11cb9280acf231ff5a86abce466212
5
5
  SHA512:
6
- metadata.gz: d71116d93c7ed690417b07fe001c49416da4fcbf7ce88fabc5c771bf49fa3500ffe5fa1591980ec2b24d2c150199dfe63ff714a3d7ba38377901b1acd21dc822
7
- data.tar.gz: e14256a37a9f703c0d8754437f6b267c36b2ec6f1815560075ef6a8410e45f928d8754533b3ad1776502e1e33f2f535f73946662e3f59164afb1c229c9dcc4d9
6
+ metadata.gz: 8eecc1b46ecb8f0fe191c0e2ac63f65e8a350d75f57dab0cd16f133ba8fd68a755d387104f6729c77ae954532b6a1cac0af0530a5ad38dc3f760a534d539a84d
7
+ data.tar.gz: fd4d3fc81cd835a004eb94fb659d7b689b44d7b8ec628cce8ce3db34f891f6337ffca363d5d1182f8c328b505e684d1c4d13f0238281a51545dfe83ae3b7d5b4
@@ -15,6 +15,10 @@ module Ndb
15
15
  # ("test2_" for a parallel test worker). nil by default.
16
16
  attr_accessor :collection_prefix
17
17
 
18
+ # user_agent is the token of the app (for example "myapp/1.2"). It goes
19
+ # at the end of the User-Agent of every request. nil by default.
20
+ attr_accessor :user_agent
21
+
18
22
  # The `streams:` block of config/ndb.yml, for `ndb streams`:
19
23
  # "concurrency" (the threads of each consumer class) and "only" (the
20
24
  # names of the classes to run).
@@ -38,6 +42,7 @@ module Ndb
38
42
  @timeout = settings["timeout"] if settings.key?("timeout")
39
43
  @pool_size = settings["pool_size"] if settings.key?("pool_size")
40
44
  @ready_timeout = settings["ready_timeout"] if settings.key?("ready_timeout")
45
+ @user_agent = settings["user_agent"] if settings.key?("user_agent")
41
46
  @streams = settings["streams"] if settings["streams"].is_a?(Hash)
42
47
 
43
48
  self
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ndb
4
4
  module Rails
5
- VERSION = "1.17.2"
5
+ VERSION = "1.18.1"
6
6
  end
7
7
  end
data/lib/ndb/rails.rb CHANGED
@@ -41,9 +41,22 @@ module Ndb
41
41
  token: configuration.token,
42
42
  timeout: configuration.timeout,
43
43
  pool_size: configuration.pool_size,
44
- ready_timeout: configuration.ready_timeout
44
+ ready_timeout: configuration.ready_timeout,
45
+ user_agent: user_agent
45
46
  )
46
47
  end
48
+
49
+ # The tokens that go after the User-Agent of the ndb gem: this gem,
50
+ # the Rails version when Rails is loaded, then the token of the app
51
+ # (config user_agent).
52
+ def user_agent
53
+ tokens = ["ndb-rails/#{VERSION}"]
54
+
55
+ tokens << "rails/#{::Rails.version}" if defined?(::Rails) && ::Rails.respond_to?(:version)
56
+ tokens << configuration.user_agent.to_s.strip
57
+
58
+ tokens.reject(&:empty?).join(" ")
59
+ end
47
60
  end
48
61
  end
49
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ndb-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2
4
+ version: 1.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - thadeu
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.17.2
46
+ version: 1.18.1
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '2'
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 1.17.2
56
+ version: 1.18.1
57
57
  - - "<"
58
58
  - !ruby/object:Gem::Version
59
59
  version: '2'