diff --git a/README.md b/README.md index ac2f410..e25c4a1 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,13 @@ If the connection requires requesting a new token periodically, it's easy to pro This will pre-fetch a token from the provided endpoint when the current token is either non-existent or has expired. -The `use_replication_endpoint` flag will append `/replication` to all resource queries if set to `true`. This is required -by some data sources to query resources beyond 10,000 records. +The `use_replication_endpoint` flag will append `/replication` to all resource queries if set to `true`. This is required by some data sources to query resources beyond 10,000 records. + +When using this feature, you can retrieve the next link by accessing `next_link` after gettings results: +``` + results = @client.resources["Property"].query.results + next_link = @client.resources["Property"].query.next_link +``` ### Caching Metadata diff --git a/lib/reso_transport/query.rb b/lib/reso_transport/query.rb index bfedc40..17199b1 100644 --- a/lib/reso_transport/query.rb +++ b/lib/reso_transport/query.rb @@ -66,10 +66,16 @@ def count def results parsed = handle_response response + @next_link = parsed.fetch('@odata.nextLink') results = Array(parsed.delete('value')) resource.parse(results) end + # Can only be accessed after results call + def next_link + @next_link + end + def response resource.get(compile_params) rescue Faraday::ConnectionFailed diff --git a/lib/reso_transport/version.rb b/lib/reso_transport/version.rb index 1c0952a..e941eda 100644 --- a/lib/reso_transport/version.rb +++ b/lib/reso_transport/version.rb @@ -1,3 +1,3 @@ module ResoTransport - VERSION = '1.5.8'.freeze + VERSION = '1.5.9'.freeze end