rnotifier 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rnotifier.rb +5 -1
- data/lib/rnotifier/event_data.rb +5 -2
- data/lib/rnotifier/version.rb +1 -1
- data/spec/event_data_spec.rb +8 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2114e0d1bbcc910c636ec5bb458b464a83032f7
|
4
|
+
data.tar.gz: ece609826496d1734fca46620eaafdaa3d4744b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35cc8f988db0717644c723ecf7de928285ae4341f52544cb490f86849b3802c8974d47d4b509de0ec91d043a79ad43973507c23dfb8ce59f2694dcc1b3a92997
|
7
|
+
data.tar.gz: ac4c232292e0407259f64d0c0dba2c86b052fdd20be652a44404611f490885d080deefc8bb16822888d4a7f227c7aed8901e8cb4f2f2d6a707abdf97b422cba8
|
data/lib/rnotifier.rb
CHANGED
@@ -51,7 +51,11 @@ module Rnotifier
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def event(name, params = {})
|
54
|
-
Rnotifier::EventData.new(name, params).notify if Rnotifier::Config.valid?
|
54
|
+
Rnotifier::EventData.new(name, Rnotifier::EventData::EVENT, params).notify if Rnotifier::Config.valid?
|
55
|
+
end
|
56
|
+
|
57
|
+
def alert(name, params = {})
|
58
|
+
Rnotifier::EventData.new(name, Rnotifier::EventData::ALERT, params).notify if Rnotifier::Config.valid?
|
55
59
|
end
|
56
60
|
|
57
61
|
end
|
data/lib/rnotifier/event_data.rb
CHANGED
@@ -2,14 +2,17 @@ module Rnotifier
|
|
2
2
|
class EventData
|
3
3
|
attr_reader :data
|
4
4
|
|
5
|
-
|
5
|
+
EVENT = 0
|
6
|
+
ALERT = 1
|
7
|
+
|
8
|
+
def initialize(name, type, data = {})
|
6
9
|
@data = {
|
7
10
|
:name => name,
|
8
11
|
:data => data,
|
9
12
|
:app_env => EventData.app_env,
|
10
13
|
:occurred_at => Time.now.utc.to_s,
|
11
|
-
:data_from => :event,
|
12
14
|
:rnotifier_client => Config::CLIENT,
|
15
|
+
:type => type,
|
13
16
|
}
|
14
17
|
@data[:context_data] = Thread.current[:rnotifier_context] if Thread.current[:rnotifier_context]
|
15
18
|
end
|
data/lib/rnotifier/version.rb
CHANGED
data/spec/event_data_spec.rb
CHANGED
@@ -9,12 +9,14 @@ describe Rnotifier::EventData do
|
|
9
9
|
@data = {:id => 1, :name => 'ProductX'}
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'is initialize
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
it 'is initialize event_data object' do
|
13
|
+
[:event, :alert].each do |e|
|
14
|
+
e_data = Rnotifier::EventData.new(@name, e, @data)
|
15
|
+
|
16
|
+
expect(e_data.data[:name]).to eq @name
|
17
|
+
expect(e_data.data[:data]).to eq @data
|
18
|
+
expect(e_data.data[:type]).to eq e
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
it 'sends event data to server' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rnotifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiren Patel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|