module OneSignal

Constants

API_VERSION
VERSION

Public Class Methods

config() click to toggle source
# File lib/onesignal.rb, line 51
def config
  @config ||= Configuration.new
end
configure() { |config| ... } click to toggle source
# File lib/onesignal.rb, line 12
def configure
  yield config
end
Also aliased as: define
csv_export(params = {}) click to toggle source
# File lib/onesignal.rb, line 44
def csv_export params = {}
  return unless OneSignal.config.active

  fetched = Commands::CsvExport.call params
  Responses::CsvExport.from_json fetched.body
end
define()
Alias for: configure
fetch_notification(notification_id) click to toggle source
# File lib/onesignal.rb, line 23
def fetch_notification notification_id
  return unless OneSignal.config.active

  fetched = Commands::FetchNotification.call notification_id
  Responses::Notification.from_json fetched.body
end
fetch_player(player_id) click to toggle source
# File lib/onesignal.rb, line 30
def fetch_player player_id
  return unless OneSignal.config.active

  fetched = Commands::FetchPlayer.call player_id
  Responses::Player.from_json fetched.body
end
fetch_players() click to toggle source
# File lib/onesignal.rb, line 37
def fetch_players
  return unless OneSignal.config.active

  fetched = Commands::FetchPlayers.call
  JSON.parse(fetched.body)['players'].map { |player| Responses::Player.from_json player }
end
send_notification(notification) click to toggle source
# File lib/onesignal.rb, line 16
def send_notification notification
  return unless OneSignal.config.active

  created = Commands::CreateNotification.call notification
  fetch_notification(JSON.parse(created.body)['id'])
end