chartmogul-ruby 4.15.0 → 4.16.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: 1d40707d3a05b63c0ecadcd2a871c769840ebe77182aae281e024167b6f73337
4
- data.tar.gz: 89ce86fbbeacdaa4236d00c5a4c2d24926ece3fb1c71b4504b10a6efd1a55f95
3
+ metadata.gz: 3b48a5b6b3b2809df09366a69371c17feeaa6e5d2cb24007293a2f4808ec67b2
4
+ data.tar.gz: fd6bc4894e3652d6cbb5bcbfd5dcfddff6700f8f37604382c49de973fdeef564
5
5
  SHA512:
6
- metadata.gz: 77f1fd6beaea8d60c4b4eb2a83a10fadb39ad67886a8a893340644de2864a56900e598a99a97b81b6700c465b8a201d320b5406b73bf86e470307fa80d771cde
7
- data.tar.gz: f34020017620ea6d47992fef1a74db9863929cc98c6ebf3fc5f57206779de1e4f756ab39402af88704b39077873f878336dafc0bc677f48f7157023e1b36923f
6
+ metadata.gz: 22d02d4b4e1d0b11d0a1d2cb04268a954c261504dc4357ef55b380e484ca140e89f9bcabafc6ec7f28379b1a90091b6317c2365f7976752692dd5545f2ba4a8e
7
+ data.tar.gz: f8b288fbce0af561e5b75f4501bc56467cd290a3104f369fd3f1f1a5cd8c73185c9d28becf91005aab75c8a45190a237b5967afa0181242f0753757a0f2ef8cf
@@ -55,6 +55,16 @@ module ChartMogul
55
55
  Customers.search(email, options)
56
56
  end
57
57
 
58
+ # exclude: true also adds the customer to the account's exclude list so it
59
+ # is not re-imported; see ChartMogul::ExcludedCustomer.
60
+ def self.destroy!(options = {})
61
+ params = options[:exclude] ? { exclude: true } : nil
62
+ handling_errors do
63
+ connection.delete("#{resource_path.apply(options)}/#{options[:uuid]}", params)
64
+ end
65
+ true
66
+ end
67
+
58
68
  def self.find_by_external_id(external_id)
59
69
  all(external_id: external_id).first
60
70
  end
@@ -95,6 +105,10 @@ module ChartMogul
95
105
  true
96
106
  end
97
107
 
108
+ def destroy!(exclude: false)
109
+ self.class.destroy!(uuid: uuid, exclude: exclude)
110
+ end
111
+
98
112
  def subscriptions(options = {})
99
113
  @subscriptions ||= ChartMogul::Subscription.all(uuid, options)
100
114
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChartMogul
4
+ class ExcludedCustomer < APIResource
5
+ set_resource_name 'ExcludedCustomer'
6
+ set_resource_path '/v1/excluded_customers'
7
+
8
+ readonly_attr :customer_uuid
9
+ readonly_attr :data_source_uuid
10
+ readonly_attr :external_id
11
+ readonly_attr :name
12
+ readonly_attr :email
13
+ readonly_attr :excluded_at, type: :time
14
+
15
+ include API::Actions::Custom
16
+
17
+ def self.all(options = {})
18
+ ExcludedCustomers.all(options)
19
+ end
20
+
21
+ # Removes the customer from the exclude list. The returned
22
+ # ReincludedCustomer's status is 'reimporting' or 'manual_reimport_required'.
23
+ def self.reinclude!(customer_uuid)
24
+ json = custom_without_assign!(:delete, "#{resource_path.path}/#{customer_uuid}")
25
+ ReincludedCustomer.new_from_json(json)
26
+ end
27
+
28
+ def reinclude!
29
+ self.class.reinclude!(customer_uuid)
30
+ end
31
+ end
32
+
33
+ class ExcludedCustomers < APIResource
34
+ set_resource_name 'ExcludedCustomers'
35
+ set_resource_path '/v1/excluded_customers'
36
+
37
+ include Concerns::Entries
38
+ include Concerns::PageableWithCursor
39
+
40
+ set_entry_class ExcludedCustomer
41
+ end
42
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChartMogul
4
+ class ReincludedCustomer < ChartMogul::Object
5
+ readonly_attr :customer_uuid
6
+ readonly_attr :status
7
+ end
8
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '4.15.0'
4
+ VERSION = '4.16.0'
5
5
  end
data/lib/chartmogul.rb CHANGED
@@ -61,6 +61,8 @@ require 'chartmogul/customer_invoices'
61
61
  require 'chartmogul/customer'
62
62
  require 'chartmogul/note'
63
63
  require 'chartmogul/entity_note'
64
+ require 'chartmogul/excluded_customer'
65
+ require 'chartmogul/reincluded_customer'
64
66
  require 'chartmogul/contact'
65
67
  require 'chartmogul/data_source'
66
68
  require 'chartmogul/data_source_settings/auto_churn_subscription_setting'
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.15.0
4
+ version: 4.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Kopac
@@ -240,6 +240,7 @@ files:
240
240
  - lib/chartmogul/errors/schema_invalid_error.rb
241
241
  - lib/chartmogul/errors/server_error.rb
242
242
  - lib/chartmogul/errors/unauthorized_error.rb
243
+ - lib/chartmogul/excluded_customer.rb
243
244
  - lib/chartmogul/invoice.rb
244
245
  - lib/chartmogul/json_import.rb
245
246
  - lib/chartmogul/line_item.rb
@@ -266,6 +267,7 @@ files:
266
267
  - lib/chartmogul/plan.rb
267
268
  - lib/chartmogul/plan_group.rb
268
269
  - lib/chartmogul/plan_groups/plans.rb
270
+ - lib/chartmogul/reincluded_customer.rb
269
271
  - lib/chartmogul/resource_path.rb
270
272
  - lib/chartmogul/subscription.rb
271
273
  - lib/chartmogul/subscription_event.rb