Class: Landable::Api::AccessTokensController
- Inherits:
-
Landable::ApiController
- Object
- ApplicationController
- Landable::ApplicationController
- Landable::ApiController
- Landable::Api::AccessTokensController
- Defined in:
- app/controllers/landable/api/access_tokens_controller.rb
Constant Summary
Constants inherited from Landable::ApiController
Landable::ApiController::API_MEDIA_REGEX
Instance Method Summary collapse
Methods inherited from Landable::ApiController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/landable/api/access_tokens_controller.rb', line 12 def create ident = AuthenticationService.call(asset_token_params[:username], asset_token_params[:password]) = RegistrationService.call(ident) respond_with AccessToken.create!(author: ), status: :created rescue Landable::AuthenticationFailedError head :unauthorized end |
#destroy ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/controllers/landable/api/access_tokens_controller.rb', line 28 def destroy token = find_own_access_token token.destroy! head :no_content rescue ActiveRecord::RecordNotFound head :unauthorized end |
#show ⇒ Object
8 9 10 |
# File 'app/controllers/landable/api/access_tokens_controller.rb', line 8 def show respond_with find_own_access_token end |
#update ⇒ Object
21 22 23 24 25 26 |
# File 'app/controllers/landable/api/access_tokens_controller.rb', line 21 def update token = find_own_access_token token.refresh! respond_with token end |