chartmogul-ruby 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f528ebe8e70838100b70e1b0b303f7032bb406cb982840de597fcef929e5f1f
4
- data.tar.gz: 21150268340facfa3466b2a31d3d0eac3c1aed868608f0de265b2a6d619cb000
3
+ metadata.gz: 187a659678960cf3ea88e2b4e71fd04bb871616a83b6c32335edd61763f5fb27
4
+ data.tar.gz: 24560d0af68c270766d9313cdef508bd6a5b50697f12d05669bf89f95d380d8d
5
5
  SHA512:
6
- metadata.gz: c822a95c9fa65a4c13ad4d0bc35c370714fdfac2dd375bbca1b494ce19d2e8e6482639136a67d43278d25ae53c0e53694e02e08e7fd89b5a8c1faf077c4d559e
7
- data.tar.gz: 2313f6a228d0d0cbfd17550a41ae7fbe31be01187779217bff7a7ece3505df310bdef483eb308c784cb8dd238184955f383a0236bcb6c2b0df42e2253d14c496
6
+ metadata.gz: fece8a4dbe09c3f5b245f5dce87caefb1722a61035c7c490700f3eb8265d65dbb40dbcf5a40fabf397a616f5bb9334e9e01acd2ea08f17da5ab8d5a1c217a030
7
+ data.tar.gz: d3d6771c0768bd32c4567c44d06514fa7301dde6ac6fd635ae07762cd09a95c29615fe55a1615c7bd8dac90f2384d7d43f6b5832d24ace87e8b6cccd2d88655f
data/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 4.3.0 - March 25, 2024
4
+ - Adds support for Opportunities (https://dev.chartmogul.com/reference/opportunities)
5
+
6
+ ## Version 4.2.0 - February 8, 2024
7
+ - Add support for customer's `website_url` attribute
8
+ - Add support for customer's subscription `uuid` attribute
9
+
3
10
  ## Version 4.1.0 - December 20, 2023
4
11
  - Adds support for Customer Notes
5
12
 
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
+ # rubocop:disable Metrics/ClassLength
4
5
  class Customer < APIResource
5
6
  set_resource_name 'Customer'
6
7
  set_resource_path '/v1/customers'
7
- set_immutable_keys([:attributes, :custom])
8
+ set_immutable_keys(%i[attributes custom])
8
9
 
9
10
  readonly_attr :uuid
10
11
  readonly_attr :id
@@ -36,6 +37,7 @@ module ChartMogul
36
37
  writeable_attr :free_trial_started_at, type: :time
37
38
  writeable_attr :owner
38
39
  writeable_attr :primary_contact
40
+ writeable_attr :website_url
39
41
 
40
42
  include API::Actions::Create
41
43
  include API::Actions::Custom
@@ -92,6 +94,14 @@ module ChartMogul
92
94
  Note.create!(options.merge(customer_uuid: uuid))
93
95
  end
94
96
 
97
+ def opportunities(options = {})
98
+ Opportnities.all(options.merge(customer_uuid: uuid))
99
+ end
100
+
101
+ def create_opportunity(options = {})
102
+ Opportunity.create!(options.merge(customer_uuid: uuid))
103
+ end
104
+
95
105
  # Enrichment
96
106
  def tags
97
107
  @attributes[:tags]
@@ -159,7 +169,7 @@ module ChartMogul
159
169
  class Customers < APIResource
160
170
  set_resource_name 'Customers'
161
171
  set_resource_path '/v1/customers'
162
- set_immutable_keys([:attributes, :custom])
172
+ set_immutable_keys(%i[attributes custom])
163
173
 
164
174
  include Concerns::Entries
165
175
  include API::Actions::Custom
@@ -174,4 +184,5 @@ module ChartMogul
174
184
  custom!(:get, path.apply_with_get_params(options.merge(email: email)))
175
185
  end
176
186
  end
187
+ # rubocop:enable Metrics/ClassLength
177
188
  end
@@ -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,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module ChartMogul
6
+ class Opportunity < APIResource
7
+ set_resource_name 'Opportunity'
8
+ set_resource_path '/v1/opportunities'
9
+ set_immutable_keys([:custom])
10
+
11
+ readonly_attr :uuid
12
+ readonly_attr :created_at
13
+ readonly_attr :updated_at
14
+
15
+ writeable_attr :customer_uuid
16
+ writeable_attr :owner
17
+ writeable_attr :pipeline
18
+ writeable_attr :pipeline_stage
19
+ writeable_attr :estimated_close_date
20
+ writeable_attr :currency
21
+ writeable_attr :amount_in_cents
22
+ writeable_attr :type
23
+ writeable_attr :forecast_category
24
+ writeable_attr :win_likelihood
25
+ writeable_attr :custom
26
+
27
+ include API::Actions::Create
28
+ include API::Actions::Destroy
29
+ include API::Actions::Retrieve
30
+ include API::Actions::Update
31
+
32
+ def self.all(options = {})
33
+ Opportnities.all(options)
34
+ end
35
+ end
36
+
37
+ class Opportnities < APIResource
38
+ set_resource_name 'Opportunities'
39
+ set_resource_path '/v1/opportunities'
40
+
41
+ include Concerns::Entries
42
+ include Concerns::PageableWithCursor
43
+
44
+ set_entry_class Opportunity
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '4.1.0'
4
+ VERSION = '4.3.0'
5
5
  end
data/lib/chartmogul.rb CHANGED
@@ -64,6 +64,7 @@ require 'chartmogul/plan_group'
64
64
  require 'chartmogul/plan_groups/plans'
65
65
  require 'chartmogul/account'
66
66
  require 'chartmogul/subscription_event'
67
+ require 'chartmogul/opportunity'
67
68
 
68
69
  require 'chartmogul/metrics/arpa'
69
70
  require 'chartmogul/metrics/arr'
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.1.0
4
+ version: 4.3.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-12-20 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -250,6 +250,7 @@ files:
250
250
  - lib/chartmogul/metrics/mrr_churn_rate.rb
251
251
  - lib/chartmogul/note.rb
252
252
  - lib/chartmogul/object.rb
253
+ - lib/chartmogul/opportunity.rb
253
254
  - lib/chartmogul/ping.rb
254
255
  - lib/chartmogul/plan.rb
255
256
  - lib/chartmogul/plan_group.rb
@@ -289,8 +290,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
290
  - !ruby/object:Gem::Version
290
291
  version: '0'
291
292
  requirements: []
292
- rubygems_version: 3.4.21
293
- signing_key:
293
+ rubygems_version: 3.1.4
294
+ signing_key:
294
295
  specification_version: 4
295
296
  summary: Chartmogul API Ruby Client
296
297
  test_files: []