Module: Core::Helpers::Applications
- Included in:
- Controllers::Base
- Defined in:
- lib/core/helpers/applications.rb
Overview
Helpers to get and check OAuth applications connecting the the application.
Instance Method Summary collapse
-
#application(premium: false) ⇒ Object
Looks for the application sending the API’s request, and raises error if not found.
- #application_model ⇒ Object
Instance Method Details
#application(premium: false) ⇒ Object
Looks for the application sending the API’s request, and raises error if not found.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/core/helpers/applications.rb', line 10 def application(premium: false) return @application unless @application.nil? check_presence 'client_id' @application = application_model.find_by(client_id: params['client_id']) api_not_found 'client_id.unknown' if @application.nil? api_forbidden 'client_id.forbidden' if premium && !@application.premium @application end |
#application_model ⇒ Object
21 22 23 |
# File 'lib/core/helpers/applications.rb', line 21 def application_model Core::Models::OAuth::Application end |