Class: Algolia::DictionaryResponse
- Inherits:
-
BaseResponse
- Object
- BaseResponse
- Algolia::DictionaryResponse
- Includes:
- CallType
- Defined in:
- lib/algolia/responses/dictionary_response.rb
Constant Summary
Constants included from CallType
CallType::READ, CallType::WRITE
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#initialize(client, response) ⇒ DictionaryResponse
constructor
A new instance of DictionaryResponse.
-
#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) ⇒ DictionaryResponse
Returns a new instance of DictionaryResponse.
10 11 12 13 14 |
# File 'lib/algolia/responses/dictionary_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.
5 6 7 |
# File 'lib/algolia/responses/dictionary_response.rb', line 5 def raw_response @raw_response end |
Instance Method Details
#wait(_opts = {}) ⇒ Object
Wait for the task to complete
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/algolia/responses/dictionary_response.rb', line 20 def wait(_opts = {}) until @done res = @client.custom_request({}, path_encode('/1/task/%s', @raw_response[:taskID]), :GET, READ) status = get_option(res, 'status') if status == 'published' @done = true end sleep(Defaults::WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY / 1000) end self end |