hey-pubsub 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hey/pubsub/event.rb +2 -6
- data/lib/hey/version.rb +1 -1
- data/lib/hey.rb +1 -0
- 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: 17e52d47a26ddc8bc246c9a529de490e5296b34e
|
4
|
+
data.tar.gz: b2802f7e7e17ea5177e1f4a8827bc68891365aad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f41afce64925bcfba2f0c476f916b15d37269aa72a8b517ae33dbeceb8aaf10e20556073e39d14faa1bf5ee27ec5493e7332b48a9e395f92be3839f68b17386
|
7
|
+
data.tar.gz: 97c26cd93623698941e0cc0e4a75445f53586b88b443a2108785662d0c8ee56f1904fe4e5c38ebbb96f77e3e27f2f1b89a70147e03c7bb0f95f20f454d0e7f4e
|
data/lib/hey/pubsub/event.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Hey::Pubsub::Event
|
2
|
-
attr_writer :
|
2
|
+
attr_writer :metadata, :started_at, :ended_at
|
3
|
+
attr_accessor :name
|
3
4
|
|
4
5
|
def initialize(name:, started_at: nil, ended_at: nil, metadata: {})
|
5
6
|
@name = name
|
@@ -33,11 +34,6 @@ class Hey::Pubsub::Event
|
|
33
34
|
Hey::SanitizedHash.new(merged_data).to_h
|
34
35
|
end
|
35
36
|
|
36
|
-
def name
|
37
|
-
return @name if Hey.configuration.namespace.nil?
|
38
|
-
"#{Hey.configuration.namespace}.#{@name}"
|
39
|
-
end
|
40
|
-
|
41
37
|
def duration
|
42
38
|
return if @ended_at.nil? || @started_at.nil?
|
43
39
|
1000.0 * (@ended_at - @started_at)
|
data/lib/hey/version.rb
CHANGED
data/lib/hey.rb
CHANGED
@@ -15,6 +15,7 @@ module Hey
|
|
15
15
|
|
16
16
|
module Behavior
|
17
17
|
def publish!(event_name, payload = {}, &block)
|
18
|
+
event_name = "#{Hey.configuration.namespace}.#{event_name}" unless Hey.configuration.namespace.nil?
|
18
19
|
event = Hey::Pubsub::Event.new(name: event_name, metadata: payload)
|
19
20
|
pubsub_adapter.publish!(event, &block)
|
20
21
|
end
|