Class: CloudFivePush::Notification
- Inherits:
-
Object
- Object
- CloudFivePush::Notification
- Includes:
- HTTParty
- Defined in:
- lib/cloud_five_push/notification.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#aps_environment ⇒ Object
Returns the value of attribute aps_environment.
-
#badge ⇒ Object
Returns the value of attribute badge.
-
#broadcast ⇒ Object
Returns the value of attribute broadcast.
-
#content_available ⇒ Object
Returns the value of attribute content_available.
-
#data ⇒ Object
Returns the value of attribute data.
-
#message ⇒ Object
Returns the value of attribute message.
-
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
-
#user_identifiers ⇒ Object
Returns the value of attribute user_identifiers.
Instance Method Summary collapse
-
#initialize(api_key = nil) ⇒ Notification
constructor
debug_output $stderr.
- #notify! ⇒ Object
Constructor Details
#initialize(api_key = nil) ⇒ Notification
debug_output $stderr
13 14 15 16 17 18 19 20 21 |
# File 'lib/cloud_five_push/notification.rb', line 13 def initialize(api_key = nil) @api_key = api_key || CloudFivePush.api_key if @api_key.nil? raise "api_key is required. Pass into initializer or set CloudFivePush.api_key first" end @broadcast = false @user_identifiers = [] @aps_environment = CloudFivePush.aps_environment end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def alert @alert end |
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def api_key @api_key end |
#aps_environment ⇒ Object
Returns the value of attribute aps_environment.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def aps_environment @aps_environment end |
#badge ⇒ Object
Returns the value of attribute badge.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def badge @badge end |
#broadcast ⇒ Object
Returns the value of attribute broadcast.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def broadcast @broadcast end |
#content_available ⇒ Object
Returns the value of attribute content_available.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def content_available @content_available end |
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def data @data end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def @message end |
#scheduled_at ⇒ Object
Returns the value of attribute scheduled_at.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def scheduled_at @scheduled_at end |
#user_identifiers ⇒ Object
Returns the value of attribute user_identifiers.
7 8 9 |
# File 'lib/cloud_five_push/notification.rb', line 7 def user_identifiers @user_identifiers end |
Instance Method Details
#notify! ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cloud_five_push/notification.rb', line 23 def notify! if blank_param?(@user_identifiers) && !@broadcast raise "Please set user_identifiers or set broadcast=true" end if @broadcast && !blank_param?(@user_identifiers) raise "Can't both broadcast and set user_identifiers" end self.class.post('/api/push/notify', body: push_params).parsed_response end |