Sha256: 8b8b854c7ef31b560feeecf2a317cc9b4c96ca059a2c7ce934d148d1d21fb9bc
Contents?: true
Size: 684 Bytes
Versions: 2
Compression:
Stored size: 684 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 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lifen-0.1.1 | lib/lifen/app_authenticated_client.rb |
lifen-0.1.0 | lib/lifen/app_authenticated_client.rb |