chartmogul-ruby 4.10.0 → 4.11.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: f7f8d1c1208594c43ff8bbeefc9528987b072cb7d1c4468c14f75bd238f944c4
4
- data.tar.gz: 917becbaa53124feff780f5fe7bd0f66cf1bf8edb8ef6ce9ee7248c9e104ecd1
3
+ metadata.gz: faa555815d7e07a1c7988a30a4006a2644bacca3c8d082e9b8e7e99233d199b5
4
+ data.tar.gz: 9b95f302c336e40149799d347ef43e0ba0286663b9041dabbd1883f5d0c28d43
5
5
  SHA512:
6
- metadata.gz: 062dbecc7f32e5dc57a28451203854d23dc04b47d12730ca125da8404faaacfa72e46b105bfce1fe1e52d62d1dabe82a3539a0a5be6685ce447fef1c8fd1b60b
7
- data.tar.gz: 20a9e6cda4ccf20ebedd2180ecffaa1d5d3bf193ca0544525bc2a53b436466639e1a29e79815f31eddb5e01f4c268b4de5bb8e9e2d42404a32859f54bf49d16b
6
+ metadata.gz: c1bb1b4874f2fbc7fb164a263bcddedcdb52793fdb640726f07d694652e01d8c403851a2058e88838d402b27d663f9c670dc0848a253c6a55249186462723e02
7
+ data.tar.gz: bab85de33f8480fe7eac0065caf5f846875a45a153d46d568cfaa1ef3f548c7e898d747d4cb9d90b518cb5c6c10b8ea2b2330182ce8a15d4b82d9e9eeb0cb4ab
data/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 4.11.0 - Jan 6, 2026
4
+ - Add new API usage for Customer Subscriptions connect and disconnect
5
+ - Update retrieve to accept query params
6
+
7
+ ## Version 4.10.0 - Dec 22, 2025
8
+ - Add fetching additional DataSource fields
9
+
3
10
  ## Version 4.9.0 - Nov 25, 2025
4
11
  - Add field subscription-set-external-id to /activities, drop support for eol rubies
5
12
 
@@ -10,12 +10,15 @@ module ChartMogul
10
10
 
11
11
  module ClassMethods
12
12
  def retrieve(uuid, options = {})
13
+ path = "#{resource_path.apply(options)}/#{uuid}"
14
+ path_param_keys = resource_path.named_params.values
15
+ query_params = options.reject { |key| path_param_keys.include?(key) }
13
16
  resp = handling_errors do
14
- connection.get("#{resource_path.apply(options)}/#{uuid}") do |req|
17
+ connection.get(path) do |req|
15
18
  req.headers['Content-Type'] = 'application/json'
19
+ req.params = query_params
16
20
  end
17
21
  end
18
-
19
22
  json = ChartMogul::Utils::JSONParser.parse(resp.body, immutable_keys: immutable_keys)
20
23
  new_from_json(json)
21
24
  end
@@ -24,11 +24,6 @@ module ChartMogul
24
24
  def self.all(options = {})
25
25
  DataSources.all(options)
26
26
  end
27
-
28
- def self.retrieve(uuid, options = {})
29
- path = ChartMogul::ResourcePath.new('/v1/data_sources/:uuid')
30
- custom!(:get, path.apply_with_get_params(options.merge(uuid: uuid)))
31
- end
32
27
  end
33
28
 
34
29
  class DataSources < APIResource
@@ -7,6 +7,11 @@ module ChartMogul
7
7
 
8
8
  readonly_attr :uuid
9
9
  readonly_attr :customer_uuid
10
+ readonly_attr :disabled
11
+ readonly_attr :disabled_at
12
+ readonly_attr :disabled_by
13
+ readonly_attr :edit_history_summary
14
+ readonly_attr :errors
10
15
 
11
16
  writeable_attr :date, type: :time
12
17
  writeable_attr :currency
@@ -22,12 +22,23 @@ module ChartMogul
22
22
  def self.all(customer_uuid, options = {})
23
23
  ChartMogul::Metrics::Customers::Subscriptions.all(customer_uuid, options)
24
24
  end
25
+
26
+ def connect(data_source_uuid, customer_uuid, subscriptions)
27
+ subscriptions.unshift(self)
28
+ ChartMogul::Metrics::Customers::Subscriptions.connect(data_source_uuid, customer_uuid, subscriptions)
29
+ end
30
+
31
+ def disconnect(data_source_uuid, customer_uuid, subscriptions)
32
+ subscriptions.unshift(self)
33
+ ChartMogul::Metrics::Customers::Subscriptions.disconnect(data_source_uuid, customer_uuid, subscriptions)
34
+ end
25
35
  end
26
36
 
27
37
  class Subscriptions < APIResource
28
38
  set_resource_name 'Subscriptions'
29
39
  set_resource_path '/v1/customers/:customer_uuid/subscriptions'
30
40
 
41
+ include API::Actions::Custom
31
42
  include Concerns::Entries
32
43
  include Concerns::Pageable
33
44
  include Concerns::PageableWithCursor
@@ -38,6 +49,29 @@ module ChartMogul
38
49
  super(options.merge(customer_uuid: customer_uuid))
39
50
  end
40
51
 
52
+ def self.connect(data_source_uuid, customer_uuid, subscriptions)
53
+ custom!(:post,
54
+ "/v1/customers/#{customer_uuid}/connect_subscriptions",
55
+ connect_disconnect_body(data_source_uuid, subscriptions))
56
+ end
57
+
58
+ def self.disconnect(data_source_uuid, customer_uuid, subscriptions)
59
+ custom!(:post,
60
+ "/v1/customers/#{customer_uuid}/disconnect_subscriptions",
61
+ connect_disconnect_body(data_source_uuid, subscriptions))
62
+ end
63
+
64
+ def self.connect_disconnect_body(data_source_uuid, subscriptions)
65
+ {
66
+ subscriptions: subscriptions.uniq.map do |subscription|
67
+ {
68
+ data_source_uuid: data_source_uuid,
69
+ uuid: subscription.uuid
70
+ }
71
+ end
72
+ }
73
+ end
74
+
41
75
  def next(customer_uuid, options = {})
42
76
  Subscriptions.all(customer_uuid, options.merge(cursor: cursor))
43
77
  end
@@ -26,13 +26,19 @@ module ChartMogul
26
26
  end
27
27
 
28
28
  def connect(customer_uuid, subscriptions)
29
+ warn 'DEPRECATION WARNING: the method ChartMogul::Subscription#connect is deprecated. Use ChartMogul::Metrics::Customers::Subscription#connect instead.'
29
30
  subscriptions.unshift(self)
30
- custom!(:post, "/v1/customers/#{customer_uuid}/connect_subscriptions", subscriptions: subscriptions.map(&:serialize_for_write))
31
+ custom!(:post,
32
+ "/v1/customers/#{customer_uuid}/connect_subscriptions",
33
+ subscriptions: subscriptions.map(&:serialize_for_write))
31
34
  end
32
35
 
33
36
  def disconnect(customer_uuid, subscriptions)
37
+ warn 'DEPRECATION WARNING: the method ChartMogul::Subscription#disconnect is deprecated. Use ChartMogul::Metrics::Customers::Subscription#disconnect instead.'
34
38
  subscriptions.unshift(self)
35
- custom!(:post, "/v1/customers/#{customer_uuid}/disconnect_subscriptions", subscriptions: subscriptions.map(&:serialize_for_write))
39
+ custom!(:post,
40
+ "/v1/customers/#{customer_uuid}/disconnect_subscriptions",
41
+ subscriptions: subscriptions.map(&:serialize_for_write))
36
42
  end
37
43
 
38
44
  def self.all(customer_uuid, options = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '4.10.0'
4
+ VERSION = '4.11.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartmogul-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.0
4
+ version: 4.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Kopac
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  requirements: []
297
- rubygems_version: 3.6.9
297
+ rubygems_version: 4.0.3
298
298
  specification_version: 4
299
299
  summary: Chartmogul API Ruby Client
300
300
  test_files: []