Class: NotifyUser::UrbanAirship
- Defined in:
- app/models/notify_user/urban_airship.rb
Constant Summary
Constants inherited from Apns
Apns::PAYLOAD_LIMIT, Apns::SYMBOL_NAMES_SIZE
Instance Method Summary collapse
Methods inherited from Apns
Constructor Details
This class inherits a constructor from NotifyUser::Apns
Instance Method Details
#push ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/notify_user/urban_airship.rb', line 4 def push space_allowance = PAYLOAD_LIMIT - used_space payload = { :alias => notification.target_id, :aps => { :alert => notification.(space_allowance), :badge => notification.count_for_target }, :n_data => { '#' => notification.id, :t => notification.created_at.to_time.to_i, '?' => notification.type } } payload[:n_data]['!'] = notification.params[:action_id] if notification.params[:action_id] response = Urbanairship.push(payload) if response.success? Rails.logger.info "Push notification sent successfully." return true else Rails.logger.info "Push notification failed." return false end end |