uc3-dmp-dynamo 0.0.19 → 0.0.21

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: 772a7143667cc896819cd1aaa74e163b9c3822ad39924e35df53abac63f8134a
4
+ data.tar.gz: 1239375f6bb03b369fc4d8d2b39e4e5b21b351cc5dd9ffe63904ab18e460f7d2
5
5
  SHA512:
6
- metadata.gz: 2becae9f11b1f3fe3d5e94ffaf2ddc7a4a1911503cf81a83020370baeca497464f8b92d5dbfbdc928525e153a30c09312fa79cbe4188b7ef444b9e22cba89ba6
7
- data.tar.gz: 2df58c0c2bd4d15198d9870620d64ab823cb9c4925f344cb563e5aff8252267abdf25900a96e6e541021008a13ddf51e5f40eb9a3f28cd904c8ef40ec6b48f70
6
+ metadata.gz: f2cddf628245cdb3e38ce62615a702bee8fe6efd4ee95e1bf7ca0bb72c2f8e262063eaa62b8473626cd2d2425cba524879fab49ffdd68228e18df5948e3f4dab
7
+ data.tar.gz: 3f49213a7b16a17d6d83e413b305a8a32f7158c262320d4942bdc2282b4be2bb2a35a40e5669289f7891d47b8c1be0fed512d0a86900be1d3f6017f18739e7f5
@@ -82,6 +82,31 @@ 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
+ hash = {
88
+ table_name: @table,
89
+ consistent_read: false,
90
+ return_consumed_capacity: logger&.level == 'debug' ? 'TOTAL' : 'NONE'
91
+ }
92
+ # Look for and add any other filtering or projection args
93
+ %i[filter_expression expression_attribute_values projection_expression expression_attribute_names].each do |key|
94
+ next if args[key.to_sym].nil?
95
+
96
+ hash[key.to_sym] = args[key.to_sym]
97
+ end
98
+
99
+ logger.debug(message: "#{SOURCE} queried for: #{hash}") if logger.respond_to?(:debug)
100
+ resp = @connection.scan(hash)
101
+ return [] unless resp.items.any?
102
+ return resp.items if resp.items.first.is_a?(Hash)
103
+
104
+ resp.items.first.respond_to?(:item) ? resp.items.map(&:item) : resp.items
105
+ rescue Aws::Errors::ServiceError => e
106
+ raise ClientError, format(MSG_DYNAMO_ERROR, msg: e.message, trace: e.backtrace)
107
+ end
108
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
109
+
85
110
  # Create/Update an item
86
111
  # rubocop:disable Metrics/AbcSize
87
112
  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.21'
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.21
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