gitlab-license 1.4.0 → 1.5.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: f525ce304f2d85f5f03f545039dccf52dea44383c11d714f1ca3c0ed78e30905
4
- data.tar.gz: 7f34872e6678f0c3d9970cae4077122f96864bf9f1bec0219bae35709e538082
3
+ metadata.gz: 8e2099828f195390b3feec3baff3129202e17b50d2ef98e9db12a5627e149f9c
4
+ data.tar.gz: 50d9e48ca255e0b4cf1e6155fc8eeffaaa25c8b1682c8c04f9910135bb16fa68
5
5
  SHA512:
6
- metadata.gz: ca9c47b79cfb8d3b6bbb780e565eccaf3005bb0b6f44c03fc9d5836bc18ae57a4a694958a8e7e74a71d83d7ec2c83384283aa6ba34f859b6df34142fafb4318f
7
- data.tar.gz: 1c4ed9a4bb95a8094d11f3caec70aa94fae5651931546a3ef984500e8da7dd22f6c711b8ffe646f00f93283a557317ee3f415f44fe7c0fb660dffb0e16acc9d8
6
+ metadata.gz: 27d52f399c1640c873c34158daf4fc07a60c63df0bc1937e7559ffab7b1ebd3e2f590c98c47bde5e5855dc736d2b51efa35c1a4172a5dcde58fc7f50c8681b00
7
+ data.tar.gz: c583ecccdbb22b0849e2101e4ddba8974ba078bf4f7ecda243d2ef529f5903ddce0e3a6c78376f77bf1b2933a6e5894b0da82bee5a05dcd00cad84f7cfb36304
@@ -51,8 +51,10 @@ module Gitlab
51
51
 
52
52
  attr_reader :version
53
53
  attr_accessor :licensee, :starts_at, :expires_at, :notify_admins_at,
54
- :notify_users_at, :block_changes_at, :type, :last_synced_at,
55
- :next_sync_at, :activated_at, :restrictions
54
+ :notify_users_at, :block_changes_at, :last_synced_at, :next_sync_at,
55
+ :activated_at, :restrictions, :cloud_licensing_enabled, :auto_renew_enabled,
56
+ :seat_reconciliation_enabled, :usage_ping_required_metrics_enabled,
57
+ :generated_from_customers_dot
56
58
 
57
59
  alias_method :issued_at, :starts_at
58
60
  alias_method :issued_at=, :starts_at=
@@ -80,8 +82,6 @@ module Gitlab
80
82
  false
81
83
  elsif activated_at && !activated_at.is_a?(DateTime)
82
84
  false
83
- elsif type && type != 'cloud'
84
- false
85
85
  elsif restrictions && !restrictions.is_a?(Hash)
86
86
  false
87
87
  else
@@ -133,6 +133,26 @@ module Gitlab
133
133
  will_block_changes? && Date.today >= block_changes_at
134
134
  end
135
135
 
136
+ def cloud_licensing?
137
+ cloud_licensing_enabled == true
138
+ end
139
+
140
+ def auto_renew?
141
+ auto_renew_enabled == true
142
+ end
143
+
144
+ def seat_reconciliation?
145
+ seat_reconciliation_enabled == true
146
+ end
147
+
148
+ def usage_ping_required_metrics?
149
+ usage_ping_required_metrics_enabled == true
150
+ end
151
+
152
+ def generated_from_customers_dot?
153
+ generated_from_customers_dot == true
154
+ end
155
+
136
156
  def restricted?(key = nil)
137
157
  if key
138
158
  restricted? && restrictions.has_key?(key)
@@ -159,7 +179,13 @@ module Gitlab
159
179
  hash['next_sync_at'] = next_sync_at if will_sync?
160
180
  hash['last_synced_at'] = last_synced_at if will_sync?
161
181
  hash['activated_at'] = activated_at if activated?
162
- hash['type'] = type
182
+
183
+ hash['cloud_licensing_enabled'] = cloud_licensing?
184
+ hash['auto_renew_enabled'] = auto_renew?
185
+ hash['seat_reconciliation_enabled'] = seat_reconciliation?
186
+ hash['usage_ping_required_metrics_enabled'] = usage_ping_required_metrics?
187
+
188
+ hash['generated_from_customers_dot'] = generated_from_customers_dot?
163
189
 
164
190
  hash['restrictions'] = restrictions if restricted?
165
191
 
@@ -191,7 +217,6 @@ module Gitlab
191
217
  @version = version
192
218
 
193
219
  @licensee = attributes['licensee']
194
- @type = attributes['type']
195
220
 
196
221
  # `issued_at` is the legacy name for starts_at.
197
222
  # TODO: Move to starts_at in a next version.
@@ -203,6 +228,16 @@ module Gitlab
203
228
  set_datetime_attribute(attr_name, attributes[attr_name])
204
229
  end
205
230
 
231
+ %w[
232
+ cloud_licensing_enabled
233
+ auto_renew_enabled
234
+ seat_reconciliation_enabled
235
+ usage_ping_required_metrics_enabled
236
+ generated_from_customers_dot
237
+ ].each do |attr_name|
238
+ public_send("#{attr_name}=", attributes[attr_name] == true)
239
+ end
240
+
206
241
  restrictions = attributes['restrictions']
207
242
  if restrictions&.is_a?(Hash)
208
243
  restrictions = Hash[restrictions.map { |k, v| [k.to_sym, v] }]
@@ -215,7 +250,7 @@ module Gitlab
215
250
 
216
251
  return unless value
217
252
 
218
- send("#{attr_name}=", value)
253
+ public_send("#{attr_name}=", value)
219
254
  end
220
255
 
221
256
  def set_datetime_attribute(attr_name, value)
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  class License
3
- VERSION = '1.4.0'.freeze
3
+ VERSION = '1.5.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-license
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douwe Maan
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-04-09 00:00:00.000000000 Z
13
+ date: 2021-05-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler