Class: OneSignal::IncludedTargets
- Inherits:
-
Object
- Object
- OneSignal::IncludedTargets
- Defined in:
- lib/onesignal/included_targets.rb
Instance Attribute Summary collapse
-
#include_amazon_reg_ids ⇒ Object
readonly
Returns the value of attribute include_amazon_reg_ids.
-
#include_android_reg_ids ⇒ Object
readonly
Returns the value of attribute include_android_reg_ids.
-
#include_chrome_reg_ids ⇒ Object
readonly
Returns the value of attribute include_chrome_reg_ids.
-
#include_chrome_web_reg_ids ⇒ Object
readonly
Returns the value of attribute include_chrome_web_reg_ids.
-
#include_email_tokens ⇒ Object
readonly
Returns the value of attribute include_email_tokens.
-
#include_external_user_ids ⇒ Object
readonly
Returns the value of attribute include_external_user_ids.
-
#include_ios_tokens ⇒ Object
readonly
Returns the value of attribute include_ios_tokens.
-
#include_player_ids ⇒ Object
readonly
Returns the value of attribute include_player_ids.
-
#include_wp_wns_uris ⇒ Object
readonly
Returns the value of attribute include_wp_wns_uris.
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
-
#initialize(params) ⇒ IncludedTargets
constructor
A new instance of IncludedTargets.
- #print_warning(params, name) ⇒ Object
Constructor Details
#initialize(params) ⇒ IncludedTargets
Returns a new instance of IncludedTargets.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/onesignal/included_targets.rb', line 9 def initialize params raise ArgumentError, 'include_player_ids cannot be used with other targets' if params.key?(:include_player_ids) && params.keys.count > 1 @include_player_ids = params[:include_player_ids] @include_email_tokens = params[:include_email_tokens] @include_external_user_ids = params[:include_external_user_ids] @include_ios_tokens = print_warning params, :include_ios_tokens @include_wp_wns_uris = print_warning params, :include_wp_wns_uris @include_amazon_reg_ids = print_warning params, :include_amazon_reg_ids @include_chrome_reg_ids = print_warning params, :include_chrome_reg_ids @include_chrome_web_reg_ids = print_warning params, :include_chrome_web_reg_ids @include_android_reg_ids = print_warning params, :include_android_reg_ids end |
Instance Attribute Details
#include_amazon_reg_ids ⇒ Object (readonly)
Returns the value of attribute include_amazon_reg_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_amazon_reg_ids @include_amazon_reg_ids end |
#include_android_reg_ids ⇒ Object (readonly)
Returns the value of attribute include_android_reg_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_android_reg_ids @include_android_reg_ids end |
#include_chrome_reg_ids ⇒ Object (readonly)
Returns the value of attribute include_chrome_reg_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_chrome_reg_ids @include_chrome_reg_ids end |
#include_chrome_web_reg_ids ⇒ Object (readonly)
Returns the value of attribute include_chrome_web_reg_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_chrome_web_reg_ids @include_chrome_web_reg_ids end |
#include_email_tokens ⇒ Object (readonly)
Returns the value of attribute include_email_tokens.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_email_tokens @include_email_tokens end |
#include_external_user_ids ⇒ Object (readonly)
Returns the value of attribute include_external_user_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_external_user_ids @include_external_user_ids end |
#include_ios_tokens ⇒ Object (readonly)
Returns the value of attribute include_ios_tokens.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_ios_tokens @include_ios_tokens end |
#include_player_ids ⇒ Object (readonly)
Returns the value of attribute include_player_ids.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_player_ids @include_player_ids end |
#include_wp_wns_uris ⇒ Object (readonly)
Returns the value of attribute include_wp_wns_uris.
5 6 7 |
# File 'lib/onesignal/included_targets.rb', line 5 def include_wp_wns_uris @include_wp_wns_uris end |
Instance Method Details
#as_json(options = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/onesignal/included_targets.rb', line 33 def as_json = nil { 'include_player_ids' => @include_player_ids, 'include_email_tokens' => @include_email_tokens, 'include_external_user_ids' => @include_external_user_ids, 'include_ios_tokens' => @include_ios_tokens, 'include_wp_wns_uris' => @include_wp_wns_uris, 'include_amazon_reg_ids' => @include_amazon_reg_ids, 'include_chrome_reg_ids' => @include_chrome_reg_ids, 'include_chrome_web_reg_ids' => @include_chrome_web_reg_ids, 'include_android_reg_ids' => @include_android_reg_ids } end |
#print_warning(params, name) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/onesignal/included_targets.rb', line 24 def print_warning params, name if params.key? name OneSignal.config.logger.warn "OneSignal WARNING - Use of #{name} is not recommended. " \ 'Use either include_player_ids, include_email_tokens or include_external_user_ids. ' \ 'See https://documentation.onesignal.com/reference#section-send-to-specific-devices' end params[name] end |