Class: BlazerJsonApi::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/blazer_json_api/application_controller.rb

Direct Known Subclasses

QueriesController

Instance Method Summary collapse

Instance Method Details

#check_authenticationObject



21
22
23
24
25
# File 'app/controllers/blazer_json_api/application_controller.rb', line 21

def check_authentication
  return if BlazerJsonAPI.credentials_provided?

  render_errors(['Authentication credentials not set'], status: :unauthorized)
end

#record_not_foundObject



13
14
15
# File 'app/controllers/blazer_json_api/application_controller.rb', line 13

def record_not_found
  render json: [], status: :not_found
end

#render_errors(error_messages, status: :bad_request) ⇒ Object



17
18
19
# File 'app/controllers/blazer_json_api/application_controller.rb', line 17

def render_errors(error_messages, status: :bad_request)
  render json: { errors: error_messages }, status: status
end