crevalle-pulse 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +16 -2
- data/lib/crevalle/pulse.rb +10 -0
- data/lib/crevalle/pulse/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64f773c201b0b5c8dfa6e9a32ed35f193526b059
|
4
|
+
data.tar.gz: 0449f7775fc83d4110c518615781d1549339fefa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c1e833376a178614ece2861322b4b9f8924292d9e441873584245b3d1bb985c0774b706129216fca445d93f182c2b6f1c143be924966cedc70c8a36fc5a7eee
|
7
|
+
data.tar.gz: a2b5f94a4346d4903cd273e7d5602f27da07b4efa93269afa2eea14b3018f4b7d3c8e9b82addfc6b928c900a2691c1187962f201905e167838af64c36f7a156c
|
data/README.md
CHANGED
@@ -25,10 +25,24 @@ Drop in your api key:
|
|
25
25
|
```ruby
|
26
26
|
# config/initializers/pulse.rb
|
27
27
|
|
28
|
-
Crevalle::Pulse.config.api_key = 'your-api-uuid'
|
28
|
+
Crevalle::Pulse.config.api_key = 'your-api-uuid'
|
29
29
|
```
|
30
30
|
|
31
|
-
You're ready to send heartbeats! Anywhere in your code, such as when a user signs up, call
|
31
|
+
You're ready to send heartbeats! Anywhere in your code, such as when a user signs up, call
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Crevalle::Pulse.beat 'myapp.user-signup'
|
35
|
+
```
|
36
|
+
to send a beat to the Pulse server. This request runs in a separate thread, so you can drop the notification into your normal codepaths without worrying about performance.
|
37
|
+
|
38
|
+
|
39
|
+
## Testing
|
40
|
+
|
41
|
+
You probably don't want bunches of heartbeats sent while you're running tests. To disable beat sending, put the following in your `spec_helper.rb`:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
Crevalle::Pulse.config.disabled = true
|
45
|
+
```
|
32
46
|
|
33
47
|
|
34
48
|
© 2015 Crevalle Technologies, LLC
|
data/lib/crevalle/pulse.rb
CHANGED
@@ -18,6 +18,8 @@ module Crevalle
|
|
18
18
|
raise ArgumentError, 'please supply a beat name' if name.nil? || name == ''
|
19
19
|
raise 'Please configure with an api key' if config.api_key.nil?
|
20
20
|
|
21
|
+
return false if config.disabled?
|
22
|
+
|
21
23
|
uri = URI.parse "#{config.host}#{config.endpoint}"
|
22
24
|
http = Net::HTTP.new(uri.host, uri.port)
|
23
25
|
http.use_ssl = true
|
@@ -47,6 +49,14 @@ module Crevalle
|
|
47
49
|
def endpoint
|
48
50
|
'/api/v1/beats'
|
49
51
|
end
|
52
|
+
|
53
|
+
def disabled= d
|
54
|
+
@disabled = d
|
55
|
+
end
|
56
|
+
|
57
|
+
def disabled?
|
58
|
+
!!@disabled
|
59
|
+
end
|
50
60
|
end
|
51
61
|
end
|
52
62
|
end
|