Class: Algolia::UpdateApiKeyResponse
- Inherits:
-
BaseResponse
- Object
- BaseResponse
- Algolia::UpdateApiKeyResponse
- Includes:
- Helpers
- Defined in:
- lib/algolia/responses/update_api_key_response.rb
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#initialize(client, response, request_options) ⇒ UpdateApiKeyResponse
constructor
A new instance of UpdateApiKeyResponse.
-
#wait(opts = {}) ⇒ Object
Wait for the task to complete.
Methods included from Helpers
#check_array, #check_object, #chunk, #deserialize_settings, #get_object_id, #get_option, #handle_params, #hash_includes_subset?, included, #json_to_hash, #path_encode, #symbolize_hash, #to_json, #to_query_string
Constructor Details
#initialize(client, response, request_options) ⇒ UpdateApiKeyResponse
Returns a new instance of UpdateApiKeyResponse.
10 11 12 13 14 15 |
# File 'lib/algolia/responses/update_api_key_response.rb', line 10 def initialize(client, response, ) @client = client @raw_response = response = @done = false end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
4 5 6 |
# File 'lib/algolia/responses/update_api_key_response.rb', line 4 def raw_response @raw_response end |
Instance Method Details
#wait(opts = {}) ⇒ Object
Wait for the task to complete
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/algolia/responses/update_api_key_response.rb', line 21 def wait(opts = {}) retries_count = 1 until @done begin api_key = @client.get_api_key(@raw_response[:key], opts) @done = hash_includes_subset?(api_key, ) rescue AlgoliaError => e raise e unless e.code == 404 retries_count += 1 time_before_retry = retries_count * Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY sleep(time_before_retry.to_f / 1000) end end self end |