-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bruno Vieira <bruno@chartmogul.com>
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Upgrading to chartmogul-ruby 4.0.0 | ||
|
||
This new version replaces the existing pagination for the `.all()` endpoints that used a combination | ||
of `page` and `per_page` parameters, and instead uses a `cursor` based pagination. So to list | ||
(as an example) Plans you now can: | ||
|
||
```ruby | ||
ChartMogul.api_key = '<API key goes here>' | ||
|
||
# Getting the first page | ||
plans = ChartMogul::Plan.all(per_page: 12) | ||
|
||
# This will return an array of plans (if available), and a cursor + has_more fields | ||
{ | ||
"plans": [ | ||
{ | ||
"uuid": "some_uuid", | ||
"data_source_uuid": "some_uuid", | ||
"name": "Master Plan" | ||
} | ||
], | ||
"has_more": True, | ||
"cursor": "MjAyMy0wNy0yOFQwODowOToyMi4xNTQyMDMwMDBaJjk0NDQ0Mg==" | ||
} | ||
|
||
if plans.has_more | ||
more_plans = plans.next(per_page: 3) | ||
end | ||
``` | ||
|
||
If you have existing code that relies on the `page` parameter, those requests will now throw an error | ||
alerting you of their deprecation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module ChartMogul | ||
VERSION = '4.0.0' | ||
VERSION = '4.0.1' | ||
end |