chartmogul-ruby 4.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66ebd465c81aa14f0e68e406fd7a4b29137d3d019d6ceb4e1da1aaf1d40b0ef4
4
- data.tar.gz: 7380c7be4a87d8d8822702eeed51d50dbf36fabbb727d4469239d023282c14eb
3
+ metadata.gz: a3b8bd924faadff9fa39d58c82373990d3119062c8d41c906d860b84044ceed7
4
+ data.tar.gz: 57a6b61d7d3bf2be673e5440e13134dab756c89197327603efc4751a664aa40e
5
5
  SHA512:
6
- metadata.gz: 20c35e5c04d023dce1487916c10a543afe6773c2781ffe10b324045e9c6cad1c7e9b7521d16007fae4ce7345c1f34d06dfd40ed98dd8941ead4f435728ffda06
7
- data.tar.gz: fd0be8d9cee2c624e945f33f55effcea1825d7f72913f0d765b97e70084a1ba3fc0561ad0b922f4691e3b2daa3a70a82b87b8d7b44ec72bb69a107e528bfb332
6
+ metadata.gz: e2bcf5852f793c756bc20557cb2ba03063d096d71e713fc1d031f4eab81bc2b43e1a0d2616c74d3c4b3ae908da3e4925ae309405b424d2c35bc257586ecab19f
7
+ data.tar.gz: 99e6484f7f7d9318ac809f82c7b9ffefd28ec23601709eb4d1f18f3baa0bc21947375314ba33fced2d1d92aefd44cfb800340cf53d72f7f2c59945f868eef96d
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,15 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 4.2.0 - February 8, 2024
4
+ - Add support for customer's `website_url` attribute
5
+ - Add support for customer's subscription `uuid` attribute
6
+
7
+ ## Version 4.1.0 - December 20, 2023
8
+ - Adds support for Customer Notes
9
+
10
+ ## Version 4.0.1 - November 7 2023
11
+ - Add upgrade guide from v3.x to v4.x
12
+
3
13
  ## Version 4.0.0 - November 1 2023
4
14
  - Remove support for old pagination using `page` parameter.
5
15
  - Drop support for Ruby versions below 2.7.
@@ -36,6 +36,7 @@ module ChartMogul
36
36
  writeable_attr :free_trial_started_at, type: :time
37
37
  writeable_attr :owner
38
38
  writeable_attr :primary_contact
39
+ writeable_attr :website_url
39
40
 
40
41
  include API::Actions::Create
41
42
  include API::Actions::Custom
@@ -84,6 +85,14 @@ module ChartMogul
84
85
  Contact.create!(options.merge(customer_uuid: uuid))
85
86
  end
86
87
 
88
+ def notes(options = {})
89
+ Notes.all(options.merge(customer_uuid: uuid))
90
+ end
91
+
92
+ def create_note(options = {})
93
+ Note.create!(options.merge(customer_uuid: uuid))
94
+ end
95
+
87
96
  # Enrichment
88
97
  def tags
89
98
  @attributes[:tags]
@@ -5,6 +5,7 @@ module ChartMogul
5
5
  module Customers
6
6
  class Subscription < ChartMogul::Object
7
7
  readonly_attr :id
8
+ readonly_attr :uuid
8
9
  readonly_attr :external_id
9
10
  readonly_attr :plan
10
11
  readonly_attr :quantity
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '4.0.0'
4
+ VERSION = '4.2.0'
5
5
  end
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.0.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Kopac
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2024-02-08 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,8 +289,8 @@ 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.7
291
- signing_key:
292
+ rubygems_version: 3.1.4
293
+ signing_key:
292
294
  specification_version: 4
293
295
  summary: Chartmogul API Ruby Client
294
296
  test_files: []