uc3-dmp-dynamo 0.0.19 → 0.0.20

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: 29958b8c7b5059fafbea4794dd5b49ed3806054b710fe8d83a5c2b9654280003
4
- data.tar.gz: 16cbcb62b1f1586a00c7d0c1c450c91c0958fad850e321c717e6aa41cdfa33e3
3
+ metadata.gz: 64f78e794c1060f22ab60bc6077221b7fd68ce9ed0467adbae750d0c2b7cf449
4
+ data.tar.gz: 66504b6a9b9069af77df7d4856903c1e9127b050575ed69db82d55df1e77a9a3
5
5
  SHA512:
6
- metadata.gz: 2becae9f11b1f3fe3d5e94ffaf2ddc7a4a1911503cf81a83020370baeca497464f8b92d5dbfbdc928525e153a30c09312fa79cbe4188b7ef444b9e22cba89ba6
7
- data.tar.gz: 2df58c0c2bd4d15198d9870620d64ab823cb9c4925f344cb563e5aff8252267abdf25900a96e6e541021008a13ddf51e5f40eb9a3f28cd904c8ef40ec6b48f70
6
+ metadata.gz: 0dc946f3f27b30540b5c4b5bd910565d13f64a9d75955897facf5dda44e9498719dfe0a2ac47f6ed8b5d24e74d3af32ab5522617701ae4e093328236dbe28a55
7
+ data.tar.gz: e0cb493bf071ad67f0a018d5fb9705e0b61c81882559686cc43e72a8cbe46560234a6dd5e95f8bb8a17b178d4c5b214a9eae4a5ad48fc592da1a38ee6f164b44
@@ -82,6 +82,33 @@ module Uc3DmpDynamo
82
82
  end
83
83
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
84
84
 
85
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
86
+ def scan(args:, logger: nil)
87
+ raise ClientError, MSG_INVALID_KEY unless args.is_a?(Hash) && args.fetch(:key_conditions, {}).any?
88
+
89
+ hash = {
90
+ table_name: @table,
91
+ consistent_read: false,
92
+ return_consumed_capacity: logger&.level == 'debug' ? 'TOTAL' : 'NONE'
93
+ }
94
+ # Look for and add any other filtering or projection args
95
+ %i[filter_expression expression_attribute_values projection_expression expression_attribute_names].each do |key|
96
+ next if args[key.to_sym].nil?
97
+
98
+ hash[key.to_sym] = args[key.to_sym]
99
+ end
100
+
101
+ logger.debug(message: "#{SOURCE} queried for: #{hash}") if logger.respond_to?(:debug)
102
+ resp = @connection.scan(hash)
103
+ return [] unless resp.items.any?
104
+ return resp.items if resp.items.first.is_a?(Hash)
105
+
106
+ resp.items.first.respond_to?(:item) ? resp.items.map(&:item) : resp.items
107
+ rescue Aws::Errors::ServiceError => e
108
+ raise ClientError, format(MSG_DYNAMO_ERROR, msg: e.message, trace: e.backtrace)
109
+ end
110
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
111
+
85
112
  # Create/Update an item
86
113
  # rubocop:disable Metrics/AbcSize
87
114
  def put_item(json:, logger: nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpDynamo
4
- VERSION = '0.0.19'
4
+ VERSION = '0.0.20'
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.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-04 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json