Sha256: 3d2a60669b293d2a31973c64d5bc790d5ab857a69b538fd88476b6cf969e3738

Contents?: true

Size: 1021 Bytes

Versions: 8

Compression:

Stored size: 1021 Bytes

Contents

module Algolia
  class DeleteApiKeyResponse < BaseResponse
    attr_reader :raw_response

    # @param client [Search::Client] Algolia Search Client used for verification
    # @param response [Hash] Raw response from the client
    # @param key [String] the key to check
    #
    def initialize(client, response, key)
      @client       = client
      @raw_response = response
      @key          = key
      @done         = false
    end

    # Wait for the task to complete
    #
    # @param opts [Hash] contains extra parameters to send with your query
    #
    def wait(opts = {})
      retries_count = 1

      until @done
        begin
          @client.get_api_key(@key, opts)
        rescue AlgoliaError => e
          @done = e.code == 404

          unless @done
            retries_count    += 1
            time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY
            sleep(time_before_retry.to_f / 1000)
          end
        end
      end

      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
algolia-2.3.4 lib/algolia/responses/delete_api_key_response.rb
algolia-2.3.3 lib/algolia/responses/delete_api_key_response.rb
algolia-2.3.2 lib/algolia/responses/delete_api_key_response.rb
algolia-2.3.1 lib/algolia/responses/delete_api_key_response.rb
algolia-2.3.0 lib/algolia/responses/delete_api_key_response.rb
algolia-2.2.5 lib/algolia/responses/delete_api_key_response.rb
algolia-2.2.4 lib/algolia/responses/delete_api_key_response.rb
algolia-2.2.3 lib/algolia/responses/delete_api_key_response.rb