Class: AtomicAdmin::AtomicLtiPlatformController

Inherits:
ApplicationController show all
Defined in:
app/controllers/atomic_admin/atomic_lti_platform_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

#destroyObject



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_platformObject



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

#indexObject



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_paramsObject



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

#showObject



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

#updateObject



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