Class: Vidar::HoneycombNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/vidar/honeycomb_notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil, api_key: nil, connection: Faraday.new) ⇒ HoneycombNotification

Returns a new instance of HoneycombNotification.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vidar/honeycomb_notification.rb', line 14

def initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil, api_key: nil, connection: Faraday.new)
  @github = github
  @revision = revision
  @revision_name = revision_name
  @build_url = build_url
  @api_key = api_key
  @dataset = deploy_config.honeycomb_dataset
  @connection = connection
  @start_time = Time.now.utc
  @end_time = nil
  @success = false
end

Class Method Details

.getObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/vidar/honeycomb_notification.rb', line 3

def self.get
  new(
    github:        Config.get!(:github),
    revision:      Config.get!(:revision),
    revision_name: Config.get!(:revision_name),
    build_url:     Config.build_url,
    deploy_config: Config.deploy_config,
    api_key: Config.get(:honeycomb_api_key),
  )
end

Instance Method Details

#configured?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/vidar/honeycomb_notification.rb', line 27

def configured?
  !dataset.nil? && !api_key.nil?
end

#failureObject



38
39
40
41
42
43
# File 'lib/vidar/honeycomb_notification.rb', line 38

def failure
  @end_time = Time.now.utc
  @success = false

  call
end

#successObject



31
32
33
34
35
36
# File 'lib/vidar/honeycomb_notification.rb', line 31

def success
  @end_time = Time.now.utc
  @success = true

  call
end