module Lifen class AppAuthenticatedClient < Client def post(url, params = {}) response = faraday_client.post do |req| req.url url req.headers['secret_key'] = secret_key req.headers['Content-Type'] = "application/json" req.body = JSON.generate(params) end raise Error if response.status == 500 raise Error if response.status == 400 raise InvalidSecretTokenError if response.status == 401 raise UserAlreadyExistingError if response.status == 403 json = JSON.parse response.body json end private def secret_key Lifen.configuration.secret_key end end end