chartmogul-ruby 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/4.0-Upgrade.md +43 -0
- data/README.md +4 -0
- data/changelog.md +6 -0
- data/lib/chartmogul/customer.rb +8 -0
- data/lib/chartmogul/note.rb +40 -0
- data/lib/chartmogul/version.rb +1 -1
- data/lib/chartmogul.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f528ebe8e70838100b70e1b0b303f7032bb406cb982840de597fcef929e5f1f
|
4
|
+
data.tar.gz: 21150268340facfa3466b2a31d3d0eac3c1aed868608f0de265b2a6d619cb000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c822a95c9fa65a4c13ad4d0bc35c370714fdfac2dd375bbca1b494ce19d2e8e6482639136a67d43278d25ae53c0e53694e02e08e7fd89b5a8c1faf077c4d559e
|
7
|
+
data.tar.gz: 2313f6a228d0d0cbfd17550a41ae7fbe31be01187779217bff7a7ece3505df310bdef483eb308c784cb8dd238184955f383a0236bcb6c2b0df42e2253d14c496
|
data/4.0-Upgrade.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Upgrading to chartmogul-ruby 4.0.0
|
2
|
+
|
3
|
+
This new version replaces the existing pagination for the `.all()` endpoints that used a combination
|
4
|
+
of `page` and `per_page` parameters, and instead uses a `cursor` based pagination. So to list
|
5
|
+
(as an example) Plans you now can:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
ChartMogul.api_key = '<API key goes here>'
|
9
|
+
|
10
|
+
# Getting the first page
|
11
|
+
plans = ChartMogul::Plan.all(per_page: 12)
|
12
|
+
```
|
13
|
+
|
14
|
+
This will return an array of plans (if available), and a cursor + has_more fields:
|
15
|
+
|
16
|
+
```json
|
17
|
+
{
|
18
|
+
"plans": [
|
19
|
+
{
|
20
|
+
"uuid": "some_uuid",
|
21
|
+
"data_source_uuid": "some_uuid",
|
22
|
+
"name": "Master Plan"
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"has_more": true,
|
26
|
+
"cursor": "MjAyMy0wNy0yOFQwODowOToyMi4xNTQyMDMwMDBaJjk0NDQ0Mg=="
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
# You can get the following pages by passing a cursor to .all
|
32
|
+
if plans.has_more
|
33
|
+
more_plans = ChartMogul::Plan.all(per_page: 12, cursor: plans.cursor)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Or by calling .next on the result
|
37
|
+
if plans.has_more
|
38
|
+
more_plans = plans.next(per_page: 3)
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
If you have existing code that relies on the `page` parameter, those requests will now throw an error
|
43
|
+
alerting you of their deprecation.
|
data/README.md
CHANGED
@@ -47,6 +47,7 @@ Or install it yourself as:
|
|
47
47
|
$ gem install chartmogul-ruby
|
48
48
|
|
49
49
|
### Supported Ruby Versions
|
50
|
+
|
50
51
|
This gem supports Ruby 2.7 and above.
|
51
52
|
|
52
53
|
## Configuration
|
@@ -66,6 +67,7 @@ ChartMogul.api_key = '<API key goes here>'
|
|
66
67
|
Thread-safe configuration is used if available, otherwise global is used.
|
67
68
|
|
68
69
|
Test your authentication:
|
70
|
+
|
69
71
|
```ruby
|
70
72
|
ChartMogul::Ping.ping
|
71
73
|
```
|
@@ -100,9 +102,11 @@ You can find examples for each endpoint in the ChartMogul [API documentation](ht
|
|
100
102
|
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.
|
101
103
|
|
102
104
|
You can change the retry count with:
|
105
|
+
|
103
106
|
```ruby
|
104
107
|
ChartMogul.max_retries = 15
|
105
108
|
```
|
109
|
+
|
106
110
|
Set it to 0 to disable it.
|
107
111
|
|
108
112
|
## Development
|
data/changelog.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# chartmogul-ruby Change Log
|
2
2
|
|
3
|
+
## Version 4.1.0 - December 20, 2023
|
4
|
+
- Adds support for Customer Notes
|
5
|
+
|
6
|
+
## Version 4.0.1 - November 7 2023
|
7
|
+
- Add upgrade guide from v3.x to v4.x
|
8
|
+
|
3
9
|
## Version 4.0.0 - November 1 2023
|
4
10
|
- Remove support for old pagination using `page` parameter.
|
5
11
|
- Drop support for Ruby versions below 2.7.
|
data/lib/chartmogul/customer.rb
CHANGED
@@ -84,6 +84,14 @@ module ChartMogul
|
|
84
84
|
Contact.create!(options.merge(customer_uuid: uuid))
|
85
85
|
end
|
86
86
|
|
87
|
+
def notes(options = {})
|
88
|
+
Notes.all(options.merge(customer_uuid: uuid))
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_note(options = {})
|
92
|
+
Note.create!(options.merge(customer_uuid: uuid))
|
93
|
+
end
|
94
|
+
|
87
95
|
# Enrichment
|
88
96
|
def tags
|
89
97
|
@attributes[:tags]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'forwardable'
|
4
|
+
|
5
|
+
module ChartMogul
|
6
|
+
class Note < APIResource
|
7
|
+
set_resource_name 'CustomerNote'
|
8
|
+
set_resource_path '/v1/customer_notes'
|
9
|
+
|
10
|
+
readonly_attr :uuid
|
11
|
+
|
12
|
+
writeable_attr :customer_uuid
|
13
|
+
writeable_attr :type
|
14
|
+
writeable_attr :text
|
15
|
+
writeable_attr :author
|
16
|
+
writeable_attr :text
|
17
|
+
writeable_attr :call_duration
|
18
|
+
writeable_attr :created_at
|
19
|
+
writeable_attr :updated_at
|
20
|
+
|
21
|
+
include API::Actions::Create
|
22
|
+
include API::Actions::Destroy
|
23
|
+
include API::Actions::Retrieve
|
24
|
+
include API::Actions::Update
|
25
|
+
|
26
|
+
def self.all(options = {})
|
27
|
+
Notes.all(options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Notes < APIResource
|
32
|
+
set_resource_name 'CustomerNotes'
|
33
|
+
set_resource_path '/v1/customer_notes'
|
34
|
+
|
35
|
+
include Concerns::Entries
|
36
|
+
include Concerns::PageableWithCursor
|
37
|
+
|
38
|
+
set_entry_class Note
|
39
|
+
end
|
40
|
+
end
|
data/lib/chartmogul/version.rb
CHANGED
data/lib/chartmogul.rb
CHANGED
@@ -55,6 +55,7 @@ require 'chartmogul/subscription'
|
|
55
55
|
require 'chartmogul/invoice'
|
56
56
|
require 'chartmogul/customer_invoices'
|
57
57
|
require 'chartmogul/customer'
|
58
|
+
require 'chartmogul/note'
|
58
59
|
require 'chartmogul/contact'
|
59
60
|
require 'chartmogul/data_source'
|
60
61
|
require 'chartmogul/ping'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chartmogul-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Kopac
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- ".gitignore"
|
190
190
|
- ".rspec"
|
191
191
|
- 2.0-Upgrade.md
|
192
|
+
- 4.0-Upgrade.md
|
192
193
|
- Gemfile
|
193
194
|
- LICENSE.txt
|
194
195
|
- README.md
|
@@ -247,6 +248,7 @@ files:
|
|
247
248
|
- lib/chartmogul/metrics/ltv.rb
|
248
249
|
- lib/chartmogul/metrics/mrr.rb
|
249
250
|
- lib/chartmogul/metrics/mrr_churn_rate.rb
|
251
|
+
- lib/chartmogul/note.rb
|
250
252
|
- lib/chartmogul/object.rb
|
251
253
|
- lib/chartmogul/ping.rb
|
252
254
|
- lib/chartmogul/plan.rb
|
@@ -287,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
289
|
- !ruby/object:Gem::Version
|
288
290
|
version: '0'
|
289
291
|
requirements: []
|
290
|
-
rubygems_version: 3.4.
|
292
|
+
rubygems_version: 3.4.21
|
291
293
|
signing_key:
|
292
294
|
specification_version: 4
|
293
295
|
summary: Chartmogul API Ruby Client
|