Class: TentD::API::Groups::GetActualId

Inherits:
Middleware
  • Object
show all
Defined in:
lib/tentd/api/groups.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



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tentd/api/groups.rb', line 21

def action(env)
  [:group_id, :before_id, :since_id].each do |id_key|
    if env.params[id_key]
      if g = Model::Group.first(:public_id => env.params[id_key])
        env.params[id_key] = g.id
      else
        env.params[id_key] = nil
      end
    end
  end
  env
end