Class: Api::V3::RootController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api/v3/root_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#can?, #current_ability, #current_user, #error!, #error_404!, #meta, #optional!, #requires!

Instance Method Details

#helloUserDetailSerializer

简单的 API 测试接口,需要验证,便于快速测试 OAuth 以及其他 API 的基本格式是否正确

GET /api/v3/hello

Parameters:

  • limit
    • API token

Returns:

  • (UserDetailSerializer)


16
17
18
19
20
21
22
23
# File 'app/controllers/api/v3/root_controller.rb', line 16

def hello
  optional! :limit, values: 0..100

  @meta = { time: Time.now }
  @user = current_user

  render 'api/v3/users/show'
end

#not_foundObject

Raises:

  • (ActiveRecord::RecordNotFound)


6
7
8
# File 'app/controllers/api/v3/root_controller.rb', line 6

def not_found
  raise ActiveRecord::RecordNotFound
end