Module: Virtuatable::Helpers::Applications

Included in:
Controllers::Base
Defined in:
lib/virtuatable/helpers/applications.rb

Overview

Helpers to get and check OAuth applications connecting the the application.

Author:

Instance Method Summary collapse

Instance Method Details

#applicationObject



8
9
10
# File 'lib/virtuatable/helpers/applications.rb', line 8

def application
  Arkaan::OAuth::Application.where(key: params['app_key']).first
end

#application!(premium: false) ⇒ Object

Looks for the application sending the API’s request, and raises error if not found.



13
14
15
16
17
18
19
# File 'lib/virtuatable/helpers/applications.rb', line 13

def application!(premium: false)
  check_presence 'app_key'
  api_not_found 'app_key.unknown' if application.nil?
  api_forbidden 'app_key.forbidden' if premium && !application.premium

  application
end