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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fdda4804509a222da3da5cb876ec831a829659c
4
- data.tar.gz: 1b6b2be167646512fd9078ecbd2c711a933d572f
3
+ metadata.gz: b2114e0d1bbcc910c636ec5bb458b464a83032f7
4
+ data.tar.gz: ece609826496d1734fca46620eaafdaa3d4744b2
5
5
  SHA512:
6
- metadata.gz: 98a2cde857b4e00ef0a5fbd0a8a710c5c5563c07a81f5f8c081f634514ce9e684938df5a9915aa3f8ad2c8afb30008169dd36457294f4626c0dfa192e96133bf
7
- data.tar.gz: e76ebcfd6889c2d0ac0a3ae2f8da50e986f85286f742b2caffe79ea000f8702d7e0957b782ec63b01624862bfec2fd9eebc87c9ec70203379ff0e4d96a6e0ebc
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
@@ -2,14 +2,17 @@ module Rnotifier
2
2
  class EventData
3
3
  attr_reader :data
4
4
 
5
- def initialize(name, data = {})
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
@@ -1,3 +1,3 @@
1
1
  module Rnotifier
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -9,12 +9,14 @@ describe Rnotifier::EventData do
9
9
  @data = {:id => 1, :name => 'ProductX'}
10
10
  end
11
11
 
12
- it 'is initialize exception_data object' do
13
- e_data = Rnotifier::EventData.new(@name, @data)
14
-
15
- expect(e_data.data[:name]).to eq @name
16
- expect(e_data.data[:data]).to eq @data
17
- expect(e_data.data[:data_from]).to eq :event
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.0
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-09 00:00:00.000000000 Z
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday