motion-prime/api_client.rb in motion-prime-1.0.4 vs motion-prime/api_client.rb in motion-prime-1.0.5

- old
+ new

@@ -78,11 +78,11 @@ if form_data && files.present? append_files_to_data(files, form_data) elsif progress # handle progress elsif !response.success? && allow_queue?(method, path, options) - queue(method: method, path: path, params: params) + queue(method: method, path: path, params: data) elsif response.operation.response.nil? block.call if use_callback else prepared_response = prepare_response_object(response.object) block.call(prepared_response, response.operation.response.statusCode) if use_callback @@ -121,12 +121,12 @@ def delete(path, params = {}, options = {}, &block) request(:delete, path, params, options, &block) end def queue(item) - queue_list = user_defaults['api_client_queue'].clone || [] + queue_list = MotionPrime::JSON.parse(user_defaults['api_client_queue']) || [] queue_list.push(item) - user_defaults['api_client_queue'] = queue_list + user_defaults['api_client_queue'] = MotionPrime::JSON.generate(queue_list) end # TODO: temporary solution, add real caching system here def read_cache(key) @cache ||= {} \ No newline at end of file