uc3-dmp-dynamo 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 931c83483fd3fab4e5a82c3bcf082fb061ac7a5480711207d338ef7a1d4c47e9
4
- data.tar.gz: 38f70ff121f7a86de6e7ef8575b9e9764021ea0e14cf630f6061dc75ceb45653
3
+ metadata.gz: b80170988e25aef1241fd264b2e3e6640420851e8c16209946a53067eda0d16a
4
+ data.tar.gz: 0e88dba2cae7cb9bc5427f474eb3230ff627f806e433ea43ce1d7a3ff2de9ec0
5
5
  SHA512:
6
- metadata.gz: 4eec21772847d22cee60f0a1a42b84d7e7d038ba77aeb598e6a496af8b777524a41ae925f272896ad879f8bbceb435be773156ea1ec3da6b1a1c1a65ccd9e1f1
7
- data.tar.gz: 90ff1b4ea36e4acce0cd16d9813f1902ead32663eab4974f4b42860c783c2478056531a99e85e39654a5a00b947f750d2702f355d5b88deb3db677704b005f47
6
+ metadata.gz: 1384e8054db8fb6121631b3c7f32dc5180a6136115a84672613882af1edc07310cb069ab93d9c35e9126fdc993fd21e609c6a6d05b92f4b846da631c666a3658
7
+ data.tar.gz: 98a6e2672a64efe161ca4d1893bed31a4da2252d2e22f3ec93b8cf4c638b32c5c6187b1b277b4d19c96068bc394166c5d03f11687d6a69390bbbeea7264833c8
@@ -16,21 +16,20 @@ module Uc3DmpDynamo
16
16
  MSG_MISSING_TABLE = 'No Dynamo Table defined! Looking for `ENV[\'DYNAMO_TABLE\']`'
17
17
  MSG_DYNAMO_ERROR = 'Dynamo DB Table Error - %{msg} - %{trace}'
18
18
 
19
- attr_accessor: :connection, :table, :log_writer
19
+ attr_accessor: :connection, :table
20
20
 
21
21
  def initialize(**args)
22
22
  @table = ENV['DYNAMO_TABLE']
23
23
  raise Uc3DmpDynamoError, MSG_MISSING_TABLE if @table.nil?
24
24
 
25
- @log_writer = args[:log_writer]
26
- @connection = args.fetch(:client, Aws::DynamoDB::Client.new(region: ENV.fetch('AWS_REGION', 'us-west-2')))
25
+ @connection = Aws::DynamoDB::Client.new(region: ENV.fetch('AWS_REGION', 'us-west-2'))
27
26
  end
28
27
 
29
28
  # Fetch a single item
30
29
  def get_item(key:, debug: false)
31
30
  raise Uc3DmpDynamoError, MSG_INVALID_KEY unless key.is_a?(Hash)
32
31
 
33
- resp = @client.get_item(
32
+ resp = @connection.get_item(
34
33
  { table_name: @table,
35
34
  key: key,
36
35
  consistent_read: false,
@@ -38,8 +37,9 @@ module Uc3DmpDynamo
38
37
  }
39
38
  )
40
39
  # If debug is enabled then write the response to the LogWriter
41
- if debug && @log_writer
42
- @log_writer.log_message(source: SOURCE, message: "get_item - #{key}", details: resp[:item].first)
40
+ if debug
41
+ puts "#{SOURCE} => get_item - #{key}"
42
+ puts resp[:item].first.inspect
43
43
  end
44
44
  resp[:item].first
45
45
  rescue Aws::Errors::ServiceError => e
@@ -69,11 +69,12 @@ module Uc3DmpDynamo
69
69
  hash[key.to_sym] = args[key.to_sym]
70
70
  end
71
71
 
72
- resp = @client.query(hash)
72
+ resp = @connection.query(hash)
73
73
  # If debug is enabled then write the response to the LogWriter
74
- if debug && @log_writer
75
- msg = "query - key_conditions: #{key_conditions}, projection_expression: #{projection_expression}"
76
- @log_writer.log_message(source: SOURCE, message: msg, details: resp.items)
74
+ if debug
75
+ msg = "query - args: #{args}"
76
+ puts "#{SOURCE} => query - args: #{args.inspect}"
77
+ puts resp.items.inspect
77
78
  end
78
79
  resp.items
79
80
  rescue Aws::Errors::ServiceError => e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpDynamo
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-dynamo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley