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 +4 -4
- data/lib/uc3-dmp-dynamo/client.rb +27 -0
- 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: 64f78e794c1060f22ab60bc6077221b7fd68ce9ed0467adbae750d0c2b7cf449
|
4
|
+
data.tar.gz: 66504b6a9b9069af77df7d4856903c1e9127b050575ed69db82d55df1e77a9a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
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.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-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|