Class: OpenStax::Api::V1::ApiController

Inherits:
ApplicationController
  • Object
show all
Includes:
Apipie, Roar, Roar::Rails::ControllerAdditions
Defined in:
app/controllers/openstax/api/v1/api_controller.rb

Direct Known Subclasses

OauthBasedApiController

Instance Method Summary collapse

Methods included from Apipie

included

Methods included from Roar

#get_representer, #standard_create, #standard_destroy, #standard_nested_create, #standard_read, #standard_sort, #standard_update

Instance Method Details

#current_userObject

TODO: doorkeeper users (or rather users who have doorkeeper applications) need to agree to API terms of use (need to have agreed to it at one time, can’t require them to agree when terms change since their apps are doing the talking) – this needs more thought



32
33
34
35
36
37
38
39
# File 'app/controllers/openstax/api/v1/api_controller.rb', line 32

def current_user
  @current_user ||= doorkeeper_token ? 
                    User.find(doorkeeper_token.resource_owner_id) : 
                    super
  # TODO: maybe freak out if current user is anonymous (require we know
  # who person/app is so we can do things like throttling, API terms
  # agreement, etc)
end