module AuPair::Authenticates

Public Instance Methods

authenticate!() click to toggle source
# File lib/au_pair/authenticates.rb, line 11
def authenticate!
  return true if AuPair::AuthenticationToken.valid?(token, vendor_name)
  render(:json => {'error' => 'Invalid authentication token.'}, :status => 401) and return
end
token() click to toggle source
# File lib/au_pair/authenticates.rb, line 3
def token
  request.headers['x-api-token'] || params[:api_token]
end
vendor_name() click to toggle source
# File lib/au_pair/authenticates.rb, line 7
def vendor_name
  request.headers['x-api-vendor'] || params[:api_vendor]
end