lib/scrivito/revision.rb in scrivito_sdk-1.0.0 vs lib/scrivito/revision.rb in scrivito_sdk-1.1.0.rc1

- old
+ new

@@ -3,14 +3,10 @@ class Revision < Struct.new(:id, :workspace, :base) def initialize(options) super(*options.values_at(:id, :workspace, :base)) end - def content_state - base ? workspace.base_content_state : workspace.content_state - end - def content_state_id base ? workspace.base_content_state_id : workspace.content_state_id end def content_state_node @@ -39,21 +35,27 @@ !!base end private - def internal_obj_search(query, result) - response = workspace.api_request(:get, "/objs/search", { - query: query, include_deleted: true, size: 100, offset: result.size - }) + def internal_obj_search(query, result, continuation=nil, tentative=false) + response = workspace.api_request(:get, "/objs/search", + query: query, + include_deleted: true, + size: 100, + continuation: continuation, + consistent_with: content_state_id + ) cur_result = response['results'].map { |obj_data| obj_data['id'] } result += cur_result + continuation = response['continuation'] + tentative ||= !!response['tentative'] - if result.size >= response['total'].to_i - result + if continuation + internal_obj_search(query, result, continuation, tentative) else - internal_obj_search(query, result) + [result.uniq, tentative] end end def internal_obj_mget(ids, result) response = api_request(