class GCMMiddleware::Authentication
Attributes
key[R]
Public Class Methods
new(app, options = {})
click to toggle source
Calls superclass method
# File lib/gcm_middleware/authentication.rb, line 5 def initialize(app, options = {}) super(app) @key = options.fetch(:key, '') raise ArgumentError.new('No api key was provided') if @key.nil? || @key.empty? end
Public Instance Methods
call(env)
click to toggle source
# File lib/gcm_middleware/authentication.rb, line 12 def call(env) env.request_headers['Authorization'] = auth_key @app.call(env).on_complete { |env| } end
Private Instance Methods
auth_key()
click to toggle source
# File lib/gcm_middleware/authentication.rb, line 22 def auth_key @auth_key ||= "key=#{key}".freeze end