Class: CodeBuildNotifier::BuildHistory
- Inherits:
-
Object
- Object
- CodeBuildNotifier::BuildHistory
- Defined in:
- lib/codebuild-notifier/build_history.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#current_build ⇒ Object
readonly
Returns the value of attribute current_build.
Instance Method Summary collapse
-
#initialize(config, current_build) ⇒ BuildHistory
constructor
A new instance of BuildHistory.
- #last_entry ⇒ Object
- #write_entry(source_id) {|updates| ... } ⇒ Object
Constructor Details
#initialize(config, current_build) ⇒ BuildHistory
Returns a new instance of BuildHistory.
30 31 32 33 |
# File 'lib/codebuild-notifier/build_history.rb', line 30 def initialize(config, current_build) @config = config @current_build = current_build end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
25 26 27 |
# File 'lib/codebuild-notifier/build_history.rb', line 25 def config @config end |
#current_build ⇒ Object (readonly)
Returns the value of attribute current_build.
25 26 27 |
# File 'lib/codebuild-notifier/build_history.rb', line 25 def current_build @current_build end |
Instance Method Details
#last_entry ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/codebuild-notifier/build_history.rb', line 35 def last_entry # If this build was launched using the Retry command from the console # or api we don't have a Pull Request or branch name to use in the # primary key, so we query by commit hash and project instead. item = launched_by_retry? ? find_by_commit_and_project : find_by_id # Provide .dot access to hash values from Dynamo item. item && Hashie::Mash.new(item) end |
#write_entry(source_id) {|updates| ... } ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/codebuild-notifier/build_history.rb', line 45 def write_entry(source_id) updates = hash_to_dynamo_update(new_entry).merge( key: { source_id: source_id } ) yield updates if block_given? dynamo_client.update_item( updates.merge(table_name: dynamo_table) ) end |