Class: Eventflit::NativeNotification::Client

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

Constant Summary collapse

API_PREFIX =
"publisher/app/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id, host, scheme, eventflit_client) ⇒ Client

Returns a new instance of Client.



8
9
10
11
12
13
# File 'lib/eventflit/native_notification/client.rb', line 8

def initialize(app_id, host, scheme, eventflit_client)
  @app_id = app_id
  @host = host
  @scheme = scheme
  @eventflit_client = eventflit_client
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



4
5
6
# File 'lib/eventflit/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/eventflit/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



16
17
18
19
20
21
22
23
24
# File 'lib/eventflit/native_notification/client.rb', line 16

def notify(interests, data = {})
  Request.new(
    @eventflit_client,
    :post,
    url("/publishes"),
    {},
    payload(interests, data)
  ).send_sync
end