Class: WebhookStopwatch::Client
- Inherits:
-
Object
- Object
- WebhookStopwatch::Client
- Defined in:
- lib/webhook_stopwatch/client.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Instance Method Summary collapse
-
#initialize(redis_or_url) ⇒ Client
constructor
A new instance of Client.
- #ping ⇒ Object
- #start(message_id, timestamp) ⇒ Object
- #stop(message_id, timestamp) ⇒ Object
Constructor Details
#initialize(redis_or_url) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 |
# File 'lib/webhook_stopwatch/client.rb', line 8 def initialize(redis_or_url) if redis_or_url.is_a?(String) @redis = Redis.new(:url => redis_or_url) else @redis = redis_or_url end end |
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
6 7 8 |
# File 'lib/webhook_stopwatch/client.rb', line 6 def redis @redis end |
Instance Method Details
#ping ⇒ Object
24 25 26 |
# File 'lib/webhook_stopwatch/client.rb', line 24 def ping publish(encode_json({})) end |
#start(message_id, timestamp) ⇒ Object
16 17 18 |
# File 'lib/webhook_stopwatch/client.rb', line 16 def start(, ) publish_event("start", , ) end |
#stop(message_id, timestamp) ⇒ Object
20 21 22 |
# File 'lib/webhook_stopwatch/client.rb', line 20 def stop(, ) publish_event("stop", , ) end |