Class: CircleciDeploymentNotifier::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/circleci_deployment_notifier/build.rb

Overview

The main object of this gem. Instantiated with the name of the application, can then be used to send a notification.

Instance Method Summary collapse

Constructor Details

#initialize(app_name:) ⇒ Build

Returns a new instance of Build.

Parameters:

  • app_name (String)

    Name of the application that was deployed.



12
13
14
# File 'lib/circleci_deployment_notifier/build.rb', line 12

def initialize(app_name:)
  self.app_name = app_name
end

Instance Method Details

#send_to_new_relic(new_relic_api_key:, new_relic_app_id:) ⇒ Object

Sends a deployment notification to New Relic.

Parameters:

  • new_relic_api_key (String)

    New Relic API Key

  • new_relic_app_id (String)

    New Relic Application ID



27
28
29
30
31
32
33
# File 'lib/circleci_deployment_notifier/build.rb', line 27

def send_to_new_relic(new_relic_api_key:, new_relic_app_id:)
  NewRelic.new(
    new_relic_api_key: new_relic_api_key,
    new_relic_app_id: new_relic_app_id,
    build_info: build_info,
  ).send
end

#send_to_slack(webhook_url:) ⇒ Object

Sends a notification to Slack using the Slack Webhook URL.

Parameters:

  • webhook_url (String)

    Slack Webhook URL



19
20
21
# File 'lib/circleci_deployment_notifier/build.rb', line 19

def send_to_slack(webhook_url:)
  Slack.new(webhook_url: webhook_url, app_name: app_name, build_info: build_info).send
end