dogapi 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- = Ruby client for Datadog API v1.2.5
1
+ = Ruby client for Datadog API v1.2.6
2
2
 
3
3
  The Ruby client is a library suitable for inclusion in existing Ruby projects or for development of standalone scripts. It provides an abstraction on top of Datadog's raw HTTP interface for reporting events and metrics.
4
4
 
@@ -20,6 +20,10 @@ module Dogapi
20
20
  # :priority => String
21
21
  # :parent => event ID (integer)
22
22
  # :tags => array of Strings
23
+ # :event_object => String
24
+ # :alert_type => 'success', 'error'
25
+ # :event_type => String
26
+ # :source_type_name => String
23
27
  def initialize(msg_text, options={})
24
28
  defaults = {
25
29
  :date_happened => Time.now.to_i,
@@ -36,6 +40,18 @@ module Dogapi
36
40
  @priority = options[:priority]
37
41
  @parent = options[:parent]
38
42
  @tags = options[:tags]
43
+ @event_object = options[:event_object]
44
+ @alert_type = options[:alert_type]
45
+ @event_type = options[:event_type]
46
+ @source_type_name = options[:source_type_name]
47
+ end
48
+
49
+ # Copy and pasted from the internets
50
+ # http://stackoverflow.com/a/5031637/25276
51
+ def to_hash
52
+ Hash[instance_variables.map { |var|
53
+ [var[1..-1].to_sym, instance_variable_get(var)]
54
+ }]
39
55
  end
40
56
  end
41
57
 
@@ -14,18 +14,15 @@ module Dogapi
14
14
  params = {
15
15
  :api_key => @api_key
16
16
  }
17
-
18
- body = {
17
+
18
+ body = event.to_hash.merge({
19
19
  :title => event.msg_title,
20
20
  :text => event.msg_text,
21
21
  :date_happened => event.date_happened.to_i,
22
- :priority => event.priority,
23
- :parent => event.parent,
24
- :tags => event.tags,
25
22
  :host => scope.host,
26
23
  :device => scope.device
27
- }
28
-
24
+ })
25
+
29
26
  request(Net::HTTP::Post, '/api/v1/events', params, body, true)
30
27
  end
31
28
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogapi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 5
10
- version: 1.2.5
9
+ - 6
10
+ version: 1.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Datadog, Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-28 00:00:00 Z
18
+ date: 2011-12-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json