dmp-dynamo_adapter 0.2.3 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dmp/dynamo_adapter.rb +5 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca8afd4ec83d2f0b665b3521e0bc9ebe7d1fbd051dea63676d9b4abaadc66ad
4
- data.tar.gz: 8dbddd4cd81b89d25561948cf519a1fb27069d9aea10c9ca06956e74b4f7d243
3
+ metadata.gz: be57979b11b7ac8a35b820835768a0d3118b54dc82134ba099c24d338858d603
4
+ data.tar.gz: 4a4e3804862bce06a1aec7cf91b0b7164c2ad3a256ce4e57fb2a7e869dcdaaee
5
5
  SHA512:
6
- metadata.gz: 28e8eb60875cc65bbbbc660a4df24a9848bedb784c20f6b5345686d39e8ceb49235b7e3e2703f37fa68e04317c24d5c06758291d4707987f82095b1d4ba70824
7
- data.tar.gz: 6482832fe3c392bd302832bad1722f331890b0b3c4892c913fea2b33fb39f2678cfe4e6e9d8c80ca5cfd9ce7345760db41f93cf2bb7726cfcc0d7edd7728cc31
6
+ metadata.gz: 69d866715074b1b34444b30cc64489af45b10ca90f5aa27d079dba2f4bfac17feaac7e74fc60a8837465fb4a67c801dbdf762665d40408fd8938c204a53d2628
7
+ data.tar.gz: 53e24074d088a3d5a5d1232257679b6018a221d7c140fe5a91e012ba409d78383035e588e344fdcf5111bd970fe639851e785c32b170e348af15d02e0547bfe8
@@ -105,13 +105,9 @@ p "FINDING BY PK: PK - #{p_key.inspect} / SK - #{s_key.inspect}"
105
105
 
106
106
  # Try to find it first
107
107
  result = find_by_json(json: json)
108
-
109
- p "RESULT:"
110
- pp result
111
-
112
108
  return { status: 500, error: result.fetch(:error, MSG_DEFAULT) } if result[:status] == 500
113
109
  # Abort if found
114
- return { status: 400, error: MSG_EXISTS } if result[:items].any?
110
+ return { status: 400, error: MSG_EXISTS } if result.fetch(:items, []).any?
115
111
 
116
112
  # allocate a DMP ID
117
113
  p_key = Dmp::DmpIdHandler.preregister_dmp_id
@@ -274,7 +270,7 @@ p "FINDING BY PROVENANCE ID: #{json['dmp_id']['identifier']}"
274
270
  },
275
271
  filter_expression: 'SK = :version',
276
272
  expression_attribute_values: {
277
- ':SK': Dmp::MetadataHandler::LATEST_VERSION
273
+ ':version': Dmp::MetadataHandler::LATEST_VERSION
278
274
  },
279
275
  return_consumed_capacity: @debug_mode ? 'TOTAL' : 'NONE'
280
276
  }
@@ -283,11 +279,11 @@ p "FINDING BY PROVENANCE ID: #{json['dmp_id']['identifier']}"
283
279
  p "RESPONSE:"
284
280
  pp response.data
285
281
 
286
- return { status: 404, error: MSG_NOT_FOUND } if response.nil? || response[:Count] <= 0
282
+ return { status: 404, error: MSG_NOT_FOUND } if response.nil? || response[:count] <= 0
287
283
 
288
284
  # If we got a hit, fetch the DMP and return it.
289
- find_by_pk(p_key: response.fetch(:LastEvaluatedKey, {})[:HashKeyElement],
290
- s_key: response.fetch(:LastEvaluatedKey, {})[:RangeKeyElement])
285
+ find_by_pk(p_key: response.fetch(:last_evaluated_key, {})[:hash_key_element],
286
+ s_key: response.fetch(:last_evaluated_key, {})[:range_key_element])
291
287
  rescue Aws::Errors::ServiceError => e
292
288
  { status: 500, error: "#{MSG_DEFAULT} - #{e.message}" }
293
289
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmp-dynamo_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - briri