model_driven_api 3.11.1 → 3.11.3

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: b61b86707e2570cba451926c97e8f3859aab908d3cafeeeb4a3ef1a1688319db
4
- data.tar.gz: 05d89a0b5675947a69579aeab316fc320de7e061c648d13882148c1c471c462f
3
+ metadata.gz: dedba0b7639aab134fe0f553794df1b69d41802b8a6b4ebb2d4209856f9549b0
4
+ data.tar.gz: 7d3b0cf36298b1c0eb71313b249bfa1d52cd9730a8c2e105e568449a13833121
5
5
  SHA512:
6
- metadata.gz: 266a7903c7736fa65577d7e7f33466a965882af174619b957755eca5ca8901c920429a3c39daf48f1689450d40177a71a4db9c413eb4442210abae2c4ec3f6ec
7
- data.tar.gz: 37139ea1c430213aa4e8bdd43b9d770f7e08bd7d1df4bd898dd561a3112f550d9ded0b411f38ab4bd982af5716a0b0963042aca2c7a782d25b59fa7f459dc850
6
+ metadata.gz: baaf85e519014c7c5a068fae14b0b12d43c96486956d109dacfe8d9976a01134c06118e4f26e36f4355e11c644324ac00c74d50d1115be89115ce0bfcd9317e4
7
+ data.tar.gz: d01443fd40d8b85cda33c531cab0646a58e5ad985834403366eeee80b291f35ac4c40b11fb169d367de28b37c32d8315cf1d96c68a17c594789b8a775577ea69
@@ -6,7 +6,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
6
6
 
7
7
  # api :GET, '/api/v2/info/version', "Just prints the APPVERSION."
8
8
  def version
9
- render json: { version: "TODO: Find a Way to Dynamically Obtain It" }.to_json, status: 200
9
+ render json: { version: ModelDrivenApi.app_version }.to_json, status: 200
10
10
  end
11
11
 
12
12
  # api :GET, '/api/v2/info/roles'
@@ -9,7 +9,6 @@ module ApiExceptionManagement
9
9
  # AccessDenied (wrong login credentials), RecordNotFound, RecordInvalid, CanCan
10
10
  # denial... answered 500. Covered by spec/lib/concerns/api_exception_management_spec.rb.
11
11
  rescue_from StandardError, with: :fivehundred!
12
- rescue_from NoMethodError, with: :not_found!
13
12
  rescue_from CanCan::AccessDenied, with: :unauthorized!
14
13
  rescue_from AuthenticateUser::AccessDenied, with: :unauthenticated!
15
14
  rescue_from ActionController::RoutingError, with: :not_found!
@@ -1,3 +1,3 @@
1
1
  module ModelDrivenApi
2
- VERSION = "3.11.1".freeze
2
+ VERSION = "3.11.3".freeze
3
3
  end
@@ -28,6 +28,14 @@ require "api/v3/serializer_factory"
28
28
  module ModelDrivenApi
29
29
  UTC_ZONE_NAMES = %w[UTC Etc/UTC].freeze
30
30
 
31
+ # The host app's deployed version: the `version` file in its root (Thecore release convention —
32
+ # CI builds and deploys when it changes; the image is `ADD . /app`, so it ships in Rails.root).
33
+ # nil when the app has no such file. Served by GET /api/v2|v3/info/version.
34
+ def self.app_version
35
+ file = Rails.root.join("version")
36
+ file.file? ? file.read.strip.presence : nil
37
+ end
38
+
31
39
  # Raises unless the app is UTC-only: +time_zone+ is config.time_zone, +db_zone+ is
32
40
  # config.active_record.default_timezone (nil = Rails' default, :utc). Called at boot by
33
41
  # ModelDrivenApi::Engine's :enforce_utc_time_zone initializer.
@@ -42,11 +50,10 @@ module ModelDrivenApi
42
50
  "(got #{db_zone.inspect})."
43
51
  end
44
52
 
53
+ # Kept for the many existing callers (host apps, mytask, ...): the implementation lives in
54
+ # thecore_backend_commons (ThecoreBackendCommons.smart_merge), which this gem depends on, so
55
+ # that lower-layer gems can compose json_attrs without referencing this gem.
45
56
  def self.smart_merge src, dest
46
- src.deeper_merge! dest, {
47
- extend_existing_arrays: true,
48
- merge_hash_arrays: true
49
- }
50
- src
57
+ ThecoreBackendCommons.smart_merge(src, dest)
51
58
  end
52
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_driven_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.1
4
+ version: 3.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '3.0'
18
+ version: '3.8'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '3.0'
25
+ version: '3.8'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jwt
28
28
  requirement: !ruby/object:Gem::Requirement