chartmogul-ruby 4.10.0 → 4.12.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: 60097ddd8ee68f3625128a8e6aa69f1192e9967bb50a62fbef007a99e1098f65
4
+ data.tar.gz: 80985ad1c0cfaa65d4849caa30830f1fe5ca343a5321ccf4d714ea1225230370
5
5
  SHA512:
6
- metadata.gz: 062dbecc7f32e5dc57a28451203854d23dc04b47d12730ca125da8404faaacfa72e46b105bfce1fe1e52d62d1dabe82a3539a0a5be6685ce447fef1c8fd1b60b
7
- data.tar.gz: 20a9e6cda4ccf20ebedd2180ecffaa1d5d3bf193ca0544525bc2a53b436466639e1a29e79815f31eddb5e01f4c268b4de5bb8e9e2d42404a32859f54bf49d16b
6
+ metadata.gz: 9de9ae516248fab40be9a6e5c7c3c121047ddc86cb73dca4aea6918900d9c14ec6e50c045a2d31dc703e22a68e4adf2705a2287b3c1b1b8964682664947a0688
7
+ data.tar.gz: 6185d768c0966c6792c9462750ca9ba113d4bd494e4de36aa12e405d7662d1bb2dbf1422bffe1e19d0baed128ee507ea900259817a138840ddfe91bc0982834a
data/changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 4.12.0 - Mar 16, 2026
4
+ - Add `external_id` key to Contact model
5
+
6
+ ## Version 4.11.0 - Jan 6, 2026
7
+ - Add new API usage for Customer Subscriptions connect and disconnect
8
+ - Update retrieve to accept query params
9
+
10
+ ## Version 4.10.0 - Dec 22, 2025
11
+ - Add fetching additional DataSource fields
12
+
3
13
  ## Version 4.9.0 - Nov 25, 2025
4
14
  - Add field subscription-set-external-id to /activities, drop support for eol rubies
5
15
 
@@ -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
@@ -20,6 +20,7 @@ module ChartMogul
20
20
  writeable_attr :linked_in
21
21
  writeable_attr :twitter
22
22
  writeable_attr :notes
23
+ writeable_attr :external_id
23
24
  writeable_attr :custom
24
25
 
25
26
  include API::Actions::Create
@@ -43,13 +44,15 @@ module ChartMogul
43
44
  if attribute_name == :custom && attribute_value.is_a?(Hash)
44
45
  payload = attribute_value.each_with_object([]) do |custom_value, arr|
45
46
  key, value = custom_value
46
- arr << { key: key, value: value }
47
+ arr << ({ key:, value: })
47
48
  end
48
49
  attributes[:custom] = payload
49
50
  else
50
51
  attributes[attribute_name] = attribute_value
51
52
  end
52
53
  end
54
+ # Include external_id attribute even when nil so callers can explicitly clear it
55
+ attributes[:external_id] = nil if instance_variable_defined?(:@external_id) && external_id.nil?
53
56
  end
54
57
  end
55
58
  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.12.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.12.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: []