Class: TentD::API::Followings::GetOne
- Inherits:
-
Middleware
- Object
- Middleware
- TentD::API::Followings::GetOne
- Defined in:
- lib/tentd/api/followings.rb
Instance Method Summary collapse
Methods inherited from Middleware
Methods included from Authorizable
#authorize_env!, #authorize_env?
Constructor Details
This class inherits a constructor from TentD::API::Middleware
Instance Method Details
#action(env) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tentd/api/followings.rb', line 30 def action(env) if (env, :read_followings) if following = Model::Following.first(:id => env.params.following_id, :confirmed => true) env.following = following env.response = following end else following = Model::Following.(env.params.following_id, env.current_auth) { |p,q,b| q << 'AND followings.confirmed = true' } if following env.response = following else raise Unauthorized end end env end |