Class: Pusher::NativeNotification::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pusher/native_notification/client.rb

Constant Summary collapse

API_PREFIX =
"server_api"
API_VERSION =
"v1"

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject (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

#hostObject (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