chartmogul-ruby 4.2.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: a3b8bd924faadff9fa39d58c82373990d3119062c8d41c906d860b84044ceed7
4
- data.tar.gz: 57a6b61d7d3bf2be673e5440e13134dab756c89197327603efc4751a664aa40e
3
+ metadata.gz: 187a659678960cf3ea88e2b4e71fd04bb871616a83b6c32335edd61763f5fb27
4
+ data.tar.gz: 24560d0af68c270766d9313cdef508bd6a5b50697f12d05669bf89f95d380d8d
5
5
  SHA512:
6
- metadata.gz: e2bcf5852f793c756bc20557cb2ba03063d096d71e713fc1d031f4eab81bc2b43e1a0d2616c74d3c4b3ae908da3e4925ae309405b424d2c35bc257586ecab19f
7
- data.tar.gz: 99e6484f7f7d9318ac809f82c7b9ffefd28ec23601709eb4d1f18f3baa0bc21947375314ba33fced2d1d92aefd44cfb800340cf53d72f7f2c59945f868eef96d
6
+ metadata.gz: fece8a4dbe09c3f5b245f5dce87caefb1722a61035c7c490700f3eb8265d65dbb40dbcf5a40fabf397a616f5bb9334e9e01acd2ea08f17da5ab8d5a1c217a030
7
+ data.tar.gz: d3d6771c0768bd32c4567c44d06514fa7301dde6ac6fd635ae07762cd09a95c29615fe55a1615c7bd8dac90f2384d7d43f6b5832d24ace87e8b6cccd2d88655f
data/changelog.md CHANGED
@@ -1,5 +1,8 @@
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
+
3
6
  ## Version 4.2.0 - February 8, 2024
4
7
  - Add support for customer's `website_url` attribute
5
8
  - Add support for customer's subscription `uuid` attribute
@@ -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
@@ -93,6 +94,14 @@ module ChartMogul
93
94
  Note.create!(options.merge(customer_uuid: uuid))
94
95
  end
95
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
+
96
105
  # Enrichment
97
106
  def tags
98
107
  @attributes[:tags]
@@ -160,7 +169,7 @@ module ChartMogul
160
169
  class Customers < APIResource
161
170
  set_resource_name 'Customers'
162
171
  set_resource_path '/v1/customers'
163
- set_immutable_keys([:attributes, :custom])
172
+ set_immutable_keys(%i[attributes custom])
164
173
 
165
174
  include Concerns::Entries
166
175
  include API::Actions::Custom
@@ -175,4 +184,5 @@ module ChartMogul
175
184
  custom!(:get, path.apply_with_get_params(options.merge(email: email)))
176
185
  end
177
186
  end
187
+ # rubocop:enable Metrics/ClassLength
178
188
  end
@@ -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.2.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.2.0
4
+ version: 4.3.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: 2024-02-08 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