Class: Services::SltcRegistrationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Services::SltcRegistrationsController
- Defined in:
- app/controllers/services/sltc_registrations_controller.rb
Constant Summary
Constants inherited from ApplicationController
ApplicationController::MAX_LIST_LENGTH
Instance Attribute Summary collapse
-
#jwt ⇒ Object
readonly
Returns the value of attribute jwt.
-
#registration ⇒ Object
readonly
Returns the value of attribute registration.
-
#valid_registration_request ⇒ Object
readonly
Returns the value of attribute valid_registration_request.
Instance Method Summary collapse
Instance Attribute Details
#jwt ⇒ Object (readonly)
Returns the value of attribute jwt.
6 7 8 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 6 def jwt @jwt end |
#registration ⇒ Object (readonly)
Returns the value of attribute registration.
4 5 6 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 4 def registration @registration end |
#valid_registration_request ⇒ Object (readonly)
Returns the value of attribute valid_registration_request.
5 6 7 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 5 def valid_registration_request @valid_registration_request end |
Instance Method Details
#complete ⇒ Object
18 19 20 21 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 18 def complete CompleteSltcRegistrationProcessContext.call(registration, completion_params) render json: { id: registration.id } end |
#create ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 23 def create # We currently deal only with type 1 if valid_registration_request[:type] != 1 ServicesMailer.notify_sltc_client_registration_invalid_request_type(valid_registration_request[:type], jwt).deliver render(nothing: true, status:500) && return end result = CreateSltcRegistrationContext.call(safe_params(valid_registration_request)) if result.errors.empty? render nothing: true, status: 200 else ServicesMailer.notify_sltc_client_registration_validation_errors(result, jwt).deliver render nothing: true, status: 500 end end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/services/sltc_registrations_controller.rb', line 14 def index @registrations = params[:status].present? ? SltcRegistration.where(status: params[:status]).order("created_at DESC").limit(MAX_LIST_LENGTH) : SltcRegistration.order("created_at DESC").limit(MAX_LIST_LENGTH) end |