Class: TentD::API::Profile::Update

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

Raises:



21
22
23
24
25
26
27
# File 'lib/tentd/api/profile.rb', line 21

def action(env)
  data = env.params.data
  type = URI.unescape(env.params.type_url)
  raise Unauthorized unless ['all', type].find { |t| env.current_auth.profile_info_types.include?(t) }
  env.updated_info = Model::ProfileInfo.update_profile(type, data)
  env
end