uc3-dmp-dynamo 0.0.24 → 0.0.26
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 +4 -4
- data/lib/uc3-dmp-dynamo/client.rb +10 -3
- data/lib/uc3-dmp-dynamo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf456be46d758f19b606a34ac44da34a12fcd85196136f87e0e5e61163ba8d6
|
4
|
+
data.tar.gz: 95347f6c9a31d8ec2f6501c640daefd5e30f36ece1b3c11cbc1415007d1d8a7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 484361366b042853264549e519763d0583b1307fc188d5c976365b0d1ebe92c643ad3556b3f8af5f40814358ec502a5dd1441505aa56f303f29c54ceacd56b19
|
7
|
+
data.tar.gz: 4f3d3d36d83f415454a8be41d3869b9612e4410a39253ac0482bcadaf573231baf89b9bdbd218daff4d43409f8cd50d706f869a5a29c4c7bb92cf075f77e1895
|
@@ -14,7 +14,7 @@ module Uc3DmpDynamo
|
|
14
14
|
attr_accessor :connection, :table
|
15
15
|
|
16
16
|
def initialize(**args)
|
17
|
-
@table = args.fetch(
|
17
|
+
@table = args.fetch(:table, ENV.fetch('DYNAMO_TABLE', nil))
|
18
18
|
raise ClientError, MSG_MISSING_TABLE if @table.nil?
|
19
19
|
|
20
20
|
@connection = Aws::DynamoDB::Client.new(region: ENV.fetch('AWS_REGION', 'us-west-2'))
|
@@ -55,14 +55,21 @@ module Uc3DmpDynamo
|
|
55
55
|
# See the DynamoDB docs for examples of key_conditions and projection_expressions
|
56
56
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
57
57
|
def query(args:, logger: nil)
|
58
|
-
raise ClientError, MSG_INVALID_KEY unless args.is_a?(Hash) &&
|
58
|
+
raise ClientError, MSG_INVALID_KEY unless args.is_a?(Hash) &&
|
59
|
+
(args.fetch(:key_conditions, {}).any? ||
|
60
|
+
args.fetch(:key_condition_expression, {}).any?)
|
59
61
|
|
60
62
|
hash = {
|
61
63
|
table_name: @table,
|
62
|
-
key_conditions: args[:key_conditions],
|
63
64
|
consistent_read: false,
|
64
65
|
return_consumed_capacity: logger&.level == 'debug' ? 'TOTAL' : 'NONE'
|
65
66
|
}
|
67
|
+
if args.fetch(:key_condition_expression, {}).any?
|
68
|
+
hash[:key_condition_expression] = args[:key_condition_expression]
|
69
|
+
else
|
70
|
+
hash[:key_conditions] = args[:key_conditions]
|
71
|
+
end
|
72
|
+
|
66
73
|
# Look for and add any other filtering or projection args
|
67
74
|
%i[index_name filter_expression expression_attribute_values projection_expression
|
68
75
|
scan_index_forward].each do |key|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-dynamo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|