Class: AtomicAdmin::AtomicLtiPlatformController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- AtomicAdmin::AtomicLtiPlatformController
- Defined in:
- app/controllers/atomic_admin/atomic_lti_platform_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #find_platform ⇒ Object
- #index ⇒ Object
- #platform_params ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 21 def create platform = AtomicLti::Platform.create!(platform_params) render json: { platform: platform } end |
#destroy ⇒ Object
37 38 39 40 41 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 37 def destroy platform = find_platform platform.destroy render json: platform end |
#find_platform ⇒ Object
7 8 9 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 7 def find_platform AtomicLti::Platform.find_by(id: params[:id]) end |
#index ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 11 def index page = AtomicLti::Platform.all.order(:id).paginate(page: params[:page], per_page: 30) render json: { platforms: page, page: params[:page], total_pages: page.total_pages } end |
#platform_params ⇒ Object
3 4 5 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 3 def platform_params params.permit(:iss, :jwks_url, :token_url, :oidc_url) end |
#show ⇒ Object
26 27 28 29 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 26 def show platform = find_platform render json: platform end |
#update ⇒ Object
31 32 33 34 35 |
# File 'app/controllers/atomic_admin/atomic_lti_platform_controller.rb', line 31 def update platform = find_platform platform.update!(platform_params) render json: { platform: find_platform } end |