dina 0.5.9.0 → 0.6.0.0

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: f95a0329ac306f75e3076a3f193da193d0722ff3677415f6301925509ed77d46
4
- data.tar.gz: 00ff890a78d22da1e6d48a664293802fe67ec1e3cd9e943c7b8816a6a422e964
3
+ metadata.gz: a04c4026773ff1a9e6b972dde877db7db2ce24f266a6eedec9c557201b913836
4
+ data.tar.gz: 8482b240897f73716a649e69c7d616cc1be6e66fd2d0f5237d2f4ef71f16af48
5
5
  SHA512:
6
- metadata.gz: f1709d2a17af2ef4ecf9c99718c708d64759ee4449d8a524159fea8a4ca7c24be3fca262a33da7eeae938766f215378000c194354cbb8f5859fbf18106c29e66
7
- data.tar.gz: 65610e9edab365148c8f390cb91c45cfb004135dc7e620734e710ba893afe12427e6efaa34c28c270cfd658935f5465ac535b0d0d4aa90c595300eb403ca552c
6
+ metadata.gz: 1ee8a029d86598ae2f8e63afe9713aad2707d19347d3e305c800a93e74a5955adff10a191e37fb5615b75ba994c07d0db72f028b002e35096ed36c4854095dca
7
+ data.tar.gz: 41640031cd2cebbb32a624866b1cd44ed7fac03b8e4b8854c9a94d1276b5a7f91f70b7d467f696d1034b998330cdeeb8577f33d1c1d5483aee0206096c12faf2
@@ -61,6 +61,24 @@ module Dina
61
61
  "Bearer " + access_token
62
62
  end
63
63
 
64
+ # Flushes instance variables from memory
65
+ # but token store file content remains intact
66
+ def self.flush
67
+ @token_store_file = nil
68
+ @user = nil
69
+ @password = nil
70
+ @server_name = nil
71
+ @client_id = nil
72
+ @endpoint_url = nil
73
+ Keycloak.auth_server_url = nil
74
+ Keycloak.realm = nil
75
+ end
76
+
77
+ # Replaces content of token store file with default values
78
+ def self.flush_token
79
+ create_empty_token
80
+ end
81
+
64
82
  class << self
65
83
  attr_accessor :endpoint_url
66
84
 
@@ -5,7 +5,7 @@ module Dina
5
5
  def initialize(opts = {})
6
6
  @titles = []
7
7
  if opts[:titles]
8
- @descriptions = opts[:titles]
8
+ @titles = opts[:titles]
9
9
  end
10
10
  if opts[:english]
11
11
  self.english_title = opts[:english]
@@ -8,21 +8,28 @@ module Dina
8
8
  before_create :on_before_create
9
9
  before_save :on_before_save
10
10
 
11
+ # Required by json_api_client
12
+ # Set by all child classes
11
13
  def self.endpoint_path
12
14
  end
13
15
 
16
+ # Required by json_api_client
14
17
  def self.site
18
+ raise ConfigItemMissing, "Missing endpoint_url from config. Perhaps Dina::Authentication.config has not yet been called." unless Dina::Authentication.endpoint_url
15
19
  Dina::Authentication.endpoint_url + "/" + endpoint_path
16
20
  end
17
21
 
22
+ # injects keybloak bearer token with all json_api_client calls
18
23
  def self.custom_headers
19
24
  { content_type: "application/vnd.api+json", authorization: Dina::Authentication.header }
20
25
  end
21
26
 
27
+ # helper method for all child classes to retrieve records by group
22
28
  def self.find_by_group(group, page: 1, per: 50)
23
29
  self.where("group.groupName": group).page(page).per(per)
24
30
  end
25
31
 
32
+ # helper method to retrieve all properties for a class
26
33
  def self.properties
27
34
  self.schema.instance_values["properties"]
28
35
  end
data/lib/dina/version.rb CHANGED
@@ -2,8 +2,8 @@ module Dina
2
2
  class Version
3
3
 
4
4
  MAJOR = 0
5
- MINOR = 5
6
- PATCH = 9
5
+ MINOR = 6
6
+ PATCH = 0
7
7
  BUILD = 0
8
8
 
9
9
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9.0
4
+ version: 0.6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client