Class: OkComputer::PusherCheck
- Inherits:
-
Check
- Object
- Check
- OkComputer::PusherCheck
- Defined in:
- lib/ok_computer/checks/pusher_check.rb
Constant Summary collapse
- ChannelError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#check ⇒ Object
Public: Return the status of the Channels check.
-
#initialize(client: nil, app_id: nil, app_key: nil, app_secret: nil, app_cluster: nil) ⇒ PusherCheck
constructor
rubocop:disable Lint/MissingSuper.
- #perform_request ⇒ Object
Constructor Details
#initialize(client: nil, app_id: nil, app_key: nil, app_secret: nil, app_cluster: nil) ⇒ PusherCheck
rubocop:disable Lint/MissingSuper
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ok_computer/checks/pusher_check.rb', line 11 def initialize(client: nil, app_id: nil, app_key: nil, app_secret: nil, app_cluster: nil) # rubocop:disable Lint/MissingSuper client ||= Pusher::Client.new( app_id: app_id, key: app_key, secret: app_secret, cluster: app_cluster, use_tls: true, ) self.client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
9 10 11 |
# File 'lib/ok_computer/checks/pusher_check.rb', line 9 def client @client end |
Instance Method Details
#check ⇒ Object
Public: Return the status of the Channels check
24 25 26 27 28 29 30 |
# File 'lib/ok_computer/checks/pusher_check.rb', line 24 def check perform_request ("Channels check successful") rescue StandardError => e ("Error: '#{e}'") mark_failure end |
#perform_request ⇒ Object
32 33 34 35 36 |
# File 'lib/ok_computer/checks/pusher_check.rb', line 32 def perform_request client.get("/channels") rescue StandardError => e raise(ChannelError, e) end |