Class: OneSignal::Client

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

Constant Summary collapse

BASE_URL =
'https://onesignal.com/api/v1'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_token: nil, app_id: nil) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
# File 'lib/onesignal/client.rb', line 7

def initialize(auth_token: nil, app_id: nil)
  @auth_token = auth_token
  @app_id = app_id

  ensure_auth_token_presence
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



5
6
7
# File 'lib/onesignal/client.rb', line 5

def app_id
  @app_id
end

#auth_tokenObject (readonly)

Returns the value of attribute auth_token.



5
6
7
# File 'lib/onesignal/client.rb', line 5

def auth_token
  @auth_token
end

Instance Method Details

#appsObject



14
15
16
# File 'lib/onesignal/client.rb', line 14

def apps
  @apps ||= AppResource.new(self)
end

#notificationsObject



24
25
26
27
28
# File 'lib/onesignal/client.rb', line 24

def notifications
  ensure_app_id_presence

  @notifications ||= NotificationResource.new(self)
end

#playersObject



18
19
20
21
22
# File 'lib/onesignal/client.rb', line 18

def players
  ensure_app_id_presence

  @players ||= PlayerResource.new(self)
end