Class: TentD::API::Followers::GetActualId

Inherits:
Middleware
  • Object
show all
Defined in:
lib/tentd/api/followers.rb

Instance Method Summary collapse

Methods inherited from Middleware

#call, #initialize

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



7
8
9
10
11
12
13
14
15
16
# File 'lib/tentd/api/followers.rb', line 7

def action(env)
  [:follower_id, :before_id, :since_id].each do |id_key|
    if env.params[id_key] && (f = Model::Follower.first(:public_id => env.params[id_key], :fields => [:id]))
      env.params[id_key] = f.id
    else
      env.params[id_key] = nil
    end
  end
  env
end