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

#helloObject

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

GET /api/v3/hello

params:

limit - API token

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

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