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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa0cf659b6f3edcd00daa7ab6d65317f4cd985f9142437d62811716843c31b4f
4
- data.tar.gz: 7decab5a151bded9ad6de31591cbc225754384a699241f1ebc314c026c484b72
3
+ metadata.gz: cafdf1d130211a041170de96bbb3fb658030f948391db697843433680f4d6971
4
+ data.tar.gz: f7e0e5317a22cb9efec2127332989e8b6465b599deee9a227cd31c3b2e705a2b
5
5
  SHA512:
6
- metadata.gz: caca36dbadabe3ab58928d443c12d180149b9fd00a6fe711d54d4d2260be72f2adb87770231973bde79d63c766bf457147f9224a38153f385767145856419ee6
7
- data.tar.gz: b4a3c40de41da8bfcad5342f64ac6cbc3b5794864543a0adcac1eaba0f78aca749277d7201bc2c2e20a15ddf90f7e89c8c50fd6f3f3d38493f3a025cae469aee
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpDynamo
4
- VERSION = '0.0.10'
4
+ VERSION = '0.0.11'
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.10
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-07 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json