dmp-dynamo_adapter 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dmp/dynamo_adapter.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a38cf33054966d1ad251334ff69c9c120810f574c68366675a3b067c63976518
|
4
|
+
data.tar.gz: efd50976eedd2b51a7c2a3877fc949b0fb99ce4162ee8f513f8edcf0385a3bd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a14dea8426ac97c743d420f3952a5d7e56cb6a95749e9f32390ca74791ac085ebdfe90381a0fd990cf3547bb3d5fcae5b78300533871a9d11892f3074ed005f8
|
7
|
+
data.tar.gz: f35b4a2a51461faf6023ec3a08f973c88f7bd379b13037e7df65cb703368bf39ca09d35ddb289e23d74c0b7dec95e1043cb3f9a85e57880d03e3a253d3a17f83
|
data/lib/dmp/dynamo_adapter.rb
CHANGED
@@ -49,8 +49,8 @@ module Dmp
|
|
49
49
|
}
|
50
50
|
)
|
51
51
|
{ status: 200, items: response.items.map(&:item).compact.uniq }
|
52
|
-
rescue Aws::Errors::ServiceError
|
53
|
-
{ status: 500, error: MSG_DEFAULT }
|
52
|
+
rescue Aws::Errors::ServiceError => e
|
53
|
+
{ status: 500, error: "#{MSG_DEFAULT} - #{e.message}" }
|
54
54
|
end
|
55
55
|
# rubocop:enable Metrics/MethodLength
|
56
56
|
|
@@ -58,6 +58,8 @@ module Dmp
|
|
58
58
|
def find_by_pk(p_key:, s_key: Dmp::MetadataHandler::LATEST_VERSION)
|
59
59
|
return { status: 404, error: MSG_NOT_FOUND } if p_key.nil?
|
60
60
|
|
61
|
+
s_key = Dmp::MetadataHandler::LATEST_VERSION if s_key.nil? || s_key.strip == ''
|
62
|
+
|
61
63
|
p "FINDING BY PK: PK - #{p_key.inspect} / SK - #{s_key.inspect}"
|
62
64
|
|
63
65
|
response = @client.get_item(
|
@@ -71,8 +73,8 @@ p "FINDING BY PK: PK - #{p_key.inspect} / SK - #{s_key.inspect}"
|
|
71
73
|
return { status: 404, error: MSG_NOT_FOUND } if response.items.empty?
|
72
74
|
|
73
75
|
{ status: 200, items: response.items.map(&:item).compact.uniq }
|
74
|
-
rescue Aws::Errors::ServiceError
|
75
|
-
{ status: 500, error: MSG_DEFAULT }
|
76
|
+
rescue Aws::Errors::ServiceError => e
|
77
|
+
{ status: 500, error: "#{MSG_DEFAULT} - #{e.message}" }
|
76
78
|
end
|
77
79
|
|
78
80
|
# Find a DMP based on the contents of the incoming JSON
|