Class: AppleWebNotificationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#add_deviceObject



3
4
5
6
7
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 3

def add_device
  puts params
  # add your code to add device
  render json: {}
end

#delete_deviceObject



9
10
11
12
13
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 9

def delete_device
  puts params
  # add your code to add device
  render json: {}
end

#logObject



21
22
23
24
25
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 21

def log
  puts params
  # errors are sent here
  render json: {}
end

#packageObject



15
16
17
18
19
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 15

def package
  packaged_data = WebNotification::NotificationPackage.instance.generate_with_auth_token(SecureRandom.base64)
  response.headers["last-modified"] = Time.zone.now.strftime("%Y-%m-%d %H:%M:%S")
  send_data(packaged_data.sysread, :type => 'application/zip', :disposition => 'inline', :filename => "package.zip") and return
end