uc3-dmp-rds 0.0.25 → 0.0.27

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: cd42f3d5944c5a82f29f7280dcb79808fcc6201c857957e6997c5187eda3d34a
4
- data.tar.gz: dd9efa204770d794fa9e3e62933ae99d67fb922a1d4ba981fb18747557545178
3
+ metadata.gz: e1afa5b7e4b77fa8dd40dbd518c9b638a99a2be5f7b79853815d355c84110459
4
+ data.tar.gz: 4603ab903dcab47f48526bc10881680dc495a950b56b2e78fc1bffe0aa7403bf
5
5
  SHA512:
6
- metadata.gz: e6d618ef509262e41e4c3ac3b70d35bad8e56c32ca44fc69a804706822cb129d875e4f4bb3f4c4f554be5c167172edc1ace7ded63ade31f39c3ac87f26dbdafb
7
- data.tar.gz: 1b037b248507347285533d8a3a9831ad25f3fcd6b20742b6d7596844d40dfeb3834273bb9a630e843f2a025815ec9b3aa603a9ef95681b66fe95cac83bcda613
6
+ metadata.gz: 21afbff738168bf4ae214dd797e35bf5267bc7e24df33bb3df91e2f48f2b36a6107894030b5b6718d769f49f65a88501359593bc70c339f0a8579d0c26ab6038
7
+ data.tar.gz: 066fed2c4517721ca649699f1c2f868bf344d4ad86cb67ff6fb8ad7f4da458c1006a97b006d012b4248657bfc2eec3fa5ed89402ebf20646559fc4968984069e
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'active_record'
4
4
  require 'active_record_simple_execute'
5
- require 'mysql2'
5
+ require 'trilogy'
6
6
 
7
7
  module Uc3DmpRds
8
8
  # Error from the Rds Adapter
@@ -32,12 +32,12 @@ module Uc3DmpRds
32
32
  password.nil? || password.to_s.strip.empty?
33
33
 
34
34
  connection = ActiveRecord::Base.establish_connection(
35
- adapter: 'mysql2',
35
+ adapter: 'trilogy',
36
36
  host: ENV.fetch('DATABASE_HOST', nil),
37
37
  port: ENV.fetch('DATABASE_PORT', nil),
38
38
  database: ENV.fetch('DATABASE_NAME', nil),
39
- username: username,
40
- password: password,
39
+ username:,
40
+ password:,
41
41
  encoding: 'utf8mb4'
42
42
  )
43
43
  !connection.nil?
@@ -50,7 +50,7 @@ module Uc3DmpRds
50
50
  def execute_query(sql:, **params)
51
51
  return [] unless sql.is_a?(String) && !sql.strip.empty? && (params.nil? || params.is_a?(Hash))
52
52
  # Verify that all of the kewords are accounted for and that values were supplied
53
- raise AdapterError, MSG_KEYWORDS_INVALID unless _verify_params(sql: sql, params: params)
53
+ raise AdapterError, MSG_KEYWORDS_INVALID unless _verify_params(sql:, params:)
54
54
 
55
55
  ActiveRecord::Base.simple_execute(sql, params)
56
56
  rescue StandardError => e
@@ -20,13 +20,13 @@ module Uc3DmpRds
20
20
  def authenticate(token:)
21
21
  raise AuthenticatorError, MSG_INVALID_TOKEN if token.nil? || token.to_s.strip.empty?
22
22
 
23
- users = _query_user(token: token)
23
+ users = _query_user(token:)
24
24
  raise AuthenticatorError, MSG_INVALID_TOKEN unless users.is_a?(Array) && users.any?
25
25
 
26
26
  user = users.first
27
27
  raise AuthenticatorError, MSG_INACTIVE_USER unless user['active']
28
28
 
29
- _serialize_user(user: user)
29
+ _serialize_user(user:)
30
30
  end
31
31
 
32
32
  private
@@ -50,10 +50,11 @@ module Uc3DmpRds
50
50
  AND i.identifier_scheme_id IN (SELECT sch.id FROM identifier_schemes sch WHERE sch.name = 'orcid')
51
51
  WHERE users.api_token = :token
52
52
  SQL
53
- users = ActiveRecord::Base.simple_execute(sql, token: token.to_s.strip)
53
+ ActiveRecord::Base.simple_execute(sql, token: token.to_s.strip)
54
54
  end
55
55
 
56
56
  # Convert the ActiveRecord query results into a JSON object
57
+ # rubocop:disable Metrics/AbcSize
57
58
  def _serialize_user(user:)
58
59
  return {} if user.nil? || user['email'].nil?
59
60
 
@@ -72,6 +73,7 @@ module Uc3DmpRds
72
73
  hash[:affiliation][:affiliation_id] = { type: 'ror', identifier: user['ror_id'] } unless user['ror_id'].nil?
73
74
  JSON.parse(hash.to_json)
74
75
  end
76
+ # rubocop:enable Metrics/AbcSize
75
77
  end
76
78
  end
77
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpRds
4
- VERSION = '0.0.25'
4
+ VERSION = '0.0.27'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-rds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_record_simple_execute
@@ -139,7 +139,7 @@ licenses:
139
139
  - MIT
140
140
  metadata:
141
141
  rubygems_mfa_required: 'false'
142
- post_install_message:
142
+ post_install_message:
143
143
  rdoc_options: []
144
144
  require_paths:
145
145
  - lib
@@ -147,15 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: '2.7'
150
+ version: '3.2'
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.1.6
158
- signing_key:
157
+ rubygems_version: 3.4.22
158
+ signing_key:
159
159
  specification_version: 4
160
160
  summary: DMPTool gem that provides general support for accessing MySQL DB hosted on
161
161
  AWS RDS