Class: TentD::API::Followers::Confirm

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



66
67
68
69
70
71
72
73
74
# File 'lib/tentd/api/followers.rb', line 66

def action(env)
  return env if env.authorized_scopes.include?(:write_followers)
  client = TentClient.new(env.profile.servers, :faraday_adapter => TentD.faraday_adapter)
  if client.follower.challenge(env.params.data.notification_path)
    env
  else
    [403, {}, ['Unauthorized Follower']]
  end
end