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



6
7
8
9
10
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 6

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

#delete_deviceObject



12
13
14
15
16
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 12

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

#indexObject



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

def index
end

#logObject



24
25
26
27
28
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 24

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

#packageObject



18
19
20
21
22
# File 'lib/rails/generators/web_notification/notification_package/templates/apple_web_notifications_controller.rb', line 18

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