class OneSignal::Client

Constants

BASE_URL

Attributes

app_id[R]
auth_token[R]

Public Class Methods

new(auth_token: nil, app_id: nil) click to toggle source
# 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

Public Instance Methods

apps() click to toggle source
# File lib/onesignal/client.rb, line 14
def apps
  @apps ||= AppResource.new(self)
end
notifications() click to toggle source
# File lib/onesignal/client.rb, line 24
def notifications
  ensure_app_id_presence

  @notifications ||= NotificationResource.new(self)
end
players() click to toggle source
# File lib/onesignal/client.rb, line 18
def players
  ensure_app_id_presence

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

Private Instance Methods

ensure_app_id_presence() click to toggle source
# File lib/onesignal/client.rb, line 38
def ensure_app_id_presence
  if app_id.nil?
    raise AppIdMissingError
  end
end
ensure_auth_token_presence() click to toggle source
# File lib/onesignal/client.rb, line 32
def ensure_auth_token_presence
  if auth_token.nil?
    raise ArgumentError, 'missing keyword: auth_token'
  end
end