uc3-dmp-dynamo 0.0.10 → 0.0.11
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 +8 -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: cafdf1d130211a041170de96bbb3fb658030f948391db697843433680f4d6971
|
4
|
+
data.tar.gz: f7e0e5317a22cb9efec2127332989e8b6465b599deee9a227cd31c3b2e705a2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3671178ca35799ab235a8f11065457b6fea2897fd32039f3c3d92ded435bedf236af2767790a4f80ef2c7c5bbf55ee00ac8671851bf15b612180ca89a7101084
|
7
|
+
data.tar.gz: a14e9969869432a435242e5d600eb3537e930f6cd548e9dbe5bca64bd9f706de7b359e3c5fe93d75a82835a4b8b96bc2a8b50b874f9d5e4b30bd443b63a37b5f
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# TODO: Be sure to update the API functions so that they call cleanse_dmp_json before
|
4
|
-
# calling Uc3DmpApiCore::Responder.respond !!!!!!!!!!
|
5
|
-
|
6
3
|
module Uc3DmpDynamo
|
7
4
|
class ClientError < StandardError; end
|
8
5
|
|
@@ -23,6 +20,14 @@ module Uc3DmpDynamo
|
|
23
20
|
@connection = Aws::DynamoDB::Client.new(region: ENV.fetch('AWS_REGION', 'us-west-2'))
|
24
21
|
end
|
25
22
|
|
23
|
+
# Quick get_item that only returns the PK to validate that the item exists
|
24
|
+
def pk_exists?(key:)
|
25
|
+
return nil unless key.is_a?(Hash) && !key['PK'].nil?
|
26
|
+
|
27
|
+
resp = client.get_item(table_name: @table, key: key, projection_expression: 'PK')
|
28
|
+
resp.item.is_a?(Hash) && resp.item['PK'] == key['PK']
|
29
|
+
end
|
30
|
+
|
26
31
|
# Fetch a single item
|
27
32
|
# rubocop:disable Metrics/AbcSize
|
28
33
|
def get_item(key:, debug: false)
|
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.11
|
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-06-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|