class CodeBuildNotifier::DynamoBase
Attributes
config[R]
current_build[R]
Public Class Methods
new(config, build)
click to toggle source
# File lib/codebuild-notifier/dynamo_base.rb, line 28 def initialize(config, build) @config = config @current_build = build end
Private Instance Methods
hash_to_dynamo_update(hash)
click to toggle source
# File lib/codebuild-notifier/dynamo_base.rb, line 39 def hash_to_dynamo_update(hash) update = hash.each_with_object( expression_attribute_names: {}, expression_attribute_values: {}, update_expression: [] ) do |(key, value), memo| memo[:expression_attribute_names]["##{key}"] = key.to_s memo[:expression_attribute_values][":#{key}"] = value memo[:update_expression] << "##{key} = :#{key}" end update.merge(update_expression: "SET #{update[:update_expression].join(', ')}") end
update_item(updates)
click to toggle source
# File lib/codebuild-notifier/dynamo_base.rb, line 33 def update_item(updates) dynamo_client.update_item( updates.merge(table_name: dynamo_table) ) end