Class: Pusher::NativeNotification::Client
- Inherits:
-
Object
- Object
- Pusher::NativeNotification::Client
- Defined in:
- lib/pusher/native_notification/client.rb
Constant Summary collapse
- API_PREFIX =
"server_api"
- API_VERSION =
"v1"
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Instance Method Summary collapse
-
#initialize(app_id, host, scheme, pusher_client) ⇒ Client
constructor
A new instance of Client.
-
#notify(interests, data = {}) ⇒ Object
Send a notification via the native notifications API.
Constructor Details
#initialize(app_id, host, scheme, pusher_client) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 |
# File 'lib/pusher/native_notification/client.rb', line 9 def initialize(app_id, host, scheme, pusher_client) @app_id = app_id @host = host @scheme = scheme @pusher_client = pusher_client end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
4 5 6 |
# File 'lib/pusher/native_notification/client.rb', line 4 def app_id @app_id end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
4 5 6 |
# File 'lib/pusher/native_notification/client.rb', line 4 def host @host end |
Instance Method Details
#notify(interests, data = {}) ⇒ Object
Send a notification via the native notifications API
17 18 19 20 21 22 23 24 25 |
# File 'lib/pusher/native_notification/client.rb', line 17 def notify(interests, data = {}) Request.new( @pusher_client, :post, url("/notifications"), {}, payload(interests, data) ).send_sync end |