Sha256: ae105313a2cdbfb51d3a7d03c69180918bc2f0637283f6c01bdc37cbccd63ecf
Contents?: true
Size: 806 Bytes
Versions: 3
Compression:
Stored size: 806 Bytes
Contents
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, "Error 500, Internal server error" if response.status == 500 raise Error, "Error 400" if response.status == 400 raise Error, "Error 404, Page not found" if response.status == 404 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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lifen-0.1.4 | lib/lifen/app_authenticated_client.rb |
lifen-0.1.3 | lib/lifen/app_authenticated_client.rb |
lifen-0.1.2 | lib/lifen/app_authenticated_client.rb |