Skip to content

Commit

Permalink
Add support for replication next link
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgronow committed Nov 5, 2021
1 parent 52a3f3d commit 3d940f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions lib/reso_transport/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/reso_transport/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ResoTransport
VERSION = '1.5.8'.freeze
VERSION = '1.5.9'.freeze
end

0 comments on commit 3d940f9

Please sign in to comment.