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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5628c26ad367ecc741e220a032d98e35d63346ae32a844d2fa874ae4414e9d9
4
- data.tar.gz: 4fb7ecba593cf5d03149308036a40a53c6158d74a320dca96289df1ae7a5e904
3
+ metadata.gz: bbf456be46d758f19b606a34ac44da34a12fcd85196136f87e0e5e61163ba8d6
4
+ data.tar.gz: 95347f6c9a31d8ec2f6501c640daefd5e30f36ece1b3c11cbc1415007d1d8a7b
5
5
  SHA512:
6
- metadata.gz: a06421e66f451cb5dd5a175c48a3ab65f2301c16195f7c8938ff854b4d42e494b8ca5e974074ae46f3f69eb503e1b48800edd8de11bbdd33ec47bdc92052d62b
7
- data.tar.gz: 20698812df5fb2de53f8eeba854d62391b376d0600adec2a465de16323f15f8634b2132caf7d3f47d4e2a7fc39cb989aea932b3de40f9792d3bc99084445140e
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('table', ENV.fetch('DYNAMO_TABLE', nil))
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) && args.fetch(:key_conditions, {}).any?
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|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpDynamo
4
- VERSION = '0.0.24'
4
+ VERSION = '0.0.26'
5
5
  end
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.24
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: 2024-07-09 00:00:00.000000000 Z
11
+ date: 2025-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json