Class: OneSignal::Client
- Inherits:
-
Object
- Object
- OneSignal::Client
- Defined in:
- lib/onesignal/client.rb
Defined Under Namespace
Classes: ApiError
Instance Method Summary collapse
- #create_notification(notification) ⇒ Object
- #fetch_notification(notification_id) ⇒ Object
- #fetch_player(player_id) ⇒ Object
- #fetch_players ⇒ Object
-
#initialize(app_id, api_key, api_url) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(app_id, api_key, api_url) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/onesignal/client.rb', line 9 def initialize app_id, api_key, api_url @app_id = app_id @api_key = api_key @api_url = api_url @conn = ::Faraday.new(url: api_url) do |faraday| # faraday.response :logger do |logger| # logger.filter(/(api_key=)(\w+)/, '\1[REMOVED]') # logger.filter(/(Basic )(\w+)/, '\1[REMOVED]') # end faraday.adapter Faraday.default_adapter end end |
Instance Method Details
#create_notification(notification) ⇒ Object
22 23 24 |
# File 'lib/onesignal/client.rb', line 22 def create_notification notification post 'notifications', notification end |
#fetch_notification(notification_id) ⇒ Object
26 27 28 |
# File 'lib/onesignal/client.rb', line 26 def fetch_notification notification_id get "notifications/#{notification_id}" end |
#fetch_player(player_id) ⇒ Object
34 35 36 |
# File 'lib/onesignal/client.rb', line 34 def fetch_player player_id get "players/#{player_id}" end |
#fetch_players ⇒ Object
30 31 32 |
# File 'lib/onesignal/client.rb', line 30 def fetch_players get 'players' end |