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

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

Instance Method Details

#helloUserDetailSerializer

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

GET /api/v3/hello

Parameters:

  • limit
    • API token

Returns:



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

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

  render json: current_user, meta: { time: Time.now }
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