Sha256: d8a81ba73f3d365a1b5dfeeb1acb8f5b6bd138864314ed2be654eb86ec059577

Contents?: true

Size: 855 Bytes

Versions: 11

Compression:

Stored size: 855 Bytes

Contents

module Lifen
  class AppAuthenticatedClient < Client

    private

      def handle_errors(response, params)
        super(response, params)

        case response.status
        when 400
          raise Error, "Error 400, Unknown error, #{response_error(response, params)}"
        when 401
          raise InvalidSecretTokenError, "Error 401, Invalid app bearer, #{response_error(response, params)}"
        when 403
          raise UserAlreadyExistingError, "Error 403, User already existing, #{response_error(response, params)}"
        when 404
          raise Error, "Error 404, Page not found, #{response_error(response, params)}"
        end

      end

      def response_error(response, params)
        "App Client, #{super(response, params)}"
      end

      def bearer
        Lifen.configuration.application_access_token
      end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lifen-1.6.2 lib/lifen/app_authenticated_client.rb
lifen-1.6.1 lib/lifen/app_authenticated_client.rb
lifen-1.6.0 lib/lifen/app_authenticated_client.rb
lifen-1.5.2 lib/lifen/app_authenticated_client.rb
lifen-1.5.1 lib/lifen/app_authenticated_client.rb
lifen-1.5.0 lib/lifen/app_authenticated_client.rb
lifen-1.4.0 lib/lifen/app_authenticated_client.rb
lifen-1.3.0 lib/lifen/app_authenticated_client.rb
lifen-1.2.0 lib/lifen/app_authenticated_client.rb
lifen-1.1.0 lib/lifen/app_authenticated_client.rb
lifen-1.0.2 lib/lifen/app_authenticated_client.rb