Class: ActionPushWeb::Pusher
- Inherits:
-
Object
- Object
- ActionPushWeb::Pusher
- Defined in:
- lib/action_push_web/pusher.rb
Instance Method Summary collapse
-
#initialize(config, notification) ⇒ Pusher
constructor
A new instance of Pusher.
- #push(connection:) ⇒ Object
Constructor Details
#initialize(config, notification) ⇒ Pusher
Returns a new instance of Pusher.
3 4 5 6 |
# File 'lib/action_push_web/pusher.rb', line 3 def initialize(config, notification) @config = config @notification = notification end |
Instance Method Details
#push(connection:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/action_push_web/pusher.rb', line 8 def push(connection:) request = Net::HTTP::Post.new(uri.request_uri, headers).tap do it.body = payload end if resolved_endpoint_ip pinned_connection.request(request) else connection.request(uri, request) end.tap { handle_response(it) } rescue OpenSSL::OpenSSLError raise TokenError.new end |