Module: DeployInfo::Notifier
- Extended by:
- Notifier
- Included in:
- Notifier
- Defined in:
- lib/deploy-info/notifier.rb
Overview
> Deploy Notification Methods
Instance Method Summary
collapse
Instance Method Details
#newrelic ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/deploy-info/notifier.rb', line 26
def newrelic
return unless Config.query_params['nr_app_id']
nr_app_id = Config.query_params['nr_app_id']
uri = URI.parse("https://api.newrelic.com/v2/applications/#{nr_app_id}/deployments.json")
request = Net::HTTP::Post.new(uri)
request.content_type = 'application/json'
request['X-Api-Key'] = Config.query_params['nr_api_key'] || Config.nr_api_key
puts Config.nr_api_key
request.body = {
deployment: {
revision: Git.revision,
user: Config.query_params['user'],
description: Config.query_params['comment']
}
}.to_json
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
end
|
#rollbar ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/deploy-info/notifier.rb', line 60
def rollbar
data = {}
data[:access_token] = Config.query_params['rb_token']
data[:environment] = Config.query_params['environment']
data[:revision] = Git.revision
data[:local_username] = Config.query_params['user']
data[:comment] = Config.query_params['comment']
uri = URI.parse('https://api.rollbar.com/api/1/deploy/')
request = Net::HTTP::Post.new(uri)
request.set_form_data(data)
Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
end
|