Class: TentD::API::Followers::Import

Inherits:
Middleware 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



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/tentd/api/followers.rb', line 92

def action(env)
  return env unless env.authorized_scopes.include?(:write_followers)
  if env.authorized_scopes.include?(:write_secrets)
    if follower = Model::Follower.create_follower(env.params.data, env.authorized_scopes)
      env.response = ''
    end
  else
    raise Unauthorized
  end
  env
end