Skip to content

Commit

Permalink
add upgrade guide from v3.x to v4.x
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Vieira <bruno@chartmogul.com>
  • Loading branch information
kmossco committed Nov 7, 2023
1 parent 8403c33 commit 97ac328
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
32 changes: 32 additions & 0 deletions 4.0-Upgrade.md
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.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Or install it yourself as:
$ gem install chartmogul-ruby

### Supported Ruby Versions

This gem supports Ruby 2.7 and above.

## Configuration
Expand All @@ -66,6 +67,7 @@ ChartMogul.api_key = '<API key goes here>'
Thread-safe configuration is used if available, otherwise global is used.

Test your authentication:

```ruby
ChartMogul::Ping.ping
```
Expand Down Expand Up @@ -100,9 +102,11 @@ You can find examples for each endpoint in the ChartMogul [API documentation](ht
The library will keep retrying if the request exceeds the rate limit or if there's any network related error. By default, the request will be retried for 20 times (approximated 15 minutes) before finally giving up.

You can change the retry count with:

```ruby
ChartMogul.max_retries = 15
```

Set it to 0 to disable it.

## Development
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# chartmogul-ruby Change Log

## Version 4.0.1 - November 7 2023
- Add upgrade guide from v3.x to v4.x

## Version 4.0.0 - November 1 2023
- Remove support for old pagination using `page` parameter.
- Drop support for Ruby versions below 2.7.
Expand Down
2 changes: 1 addition & 1 deletion lib/chartmogul/version.rb
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

0 comments on commit 97ac328

Please sign in to comment.