gitlab-license 2.0.0 → 2.1.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: 517b48dd59c73e6c06a3141dbbff736b6ac5aec0db0575e81e8eaa9efca214c3
4
- data.tar.gz: a3ae2f4b90f8ab04f042e420e81b268bd0250ff76234d29424fa22badd127ff9
3
+ metadata.gz: 1f9153bcc9df80fb7bcc879d15ae1e21709cec7a352ffd5c0c4de2ae082473d6
4
+ data.tar.gz: a36810ea464918c2f25bb40ebfe877b8561131bebfbf1e0d9530f1270f5f2816
5
5
  SHA512:
6
- metadata.gz: 7c0b2e7c189d8abad15856eea602aefa67eb772a44609278a7600365389c706aa7b0594a51fed2ea7ade3307162ecbe053d5b17ca3bc7ed0054a104988e1d88d
7
- data.tar.gz: 4dbaf5ea37ae26de84edd087269b10676879164abc0bee0578c3a6b6af88c832fe0aba70f22ee489de46eeeea2023b33c997ae999b51deeffbb0b05939662d04
6
+ metadata.gz: b37464c9ce48c030aebf3ca982bc2d4831367e0169e09c76d58e152124d6ed63202dd284e63b13c86f6eb7651cc0692db8685cc29a9bf44409167a45ce3cf722
7
+ data.tar.gz: 935474c12b21840724ae4ed064f6db461777751dae4d7454917b9ada0b93eb80138f4d678ba3b48efb6ed946da38aa11422adf5a4eadef024d3981102ec5b2cf
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  class License
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '2.1.0'.freeze
4
4
  end
5
5
  end
@@ -52,9 +52,9 @@ module Gitlab
52
52
  attr_reader :version
53
53
  attr_accessor :licensee, :starts_at, :expires_at, :notify_admins_at,
54
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, :operational_metrics_enabled,
57
- :generated_from_customers_dot
55
+ :activated_at, :restrictions, :cloud_licensing_enabled,
56
+ :offline_cloud_licensing_enabled, :auto_renew_enabled, :seat_reconciliation_enabled,
57
+ :operational_metrics_enabled, :generated_from_customers_dot
58
58
 
59
59
  alias_method :issued_at, :starts_at
60
60
  alias_method :issued_at=, :starts_at=
@@ -84,6 +84,8 @@ module Gitlab
84
84
  false
85
85
  elsif restrictions && !restrictions.is_a?(Hash)
86
86
  false
87
+ elsif !cloud_licensing? && offline_cloud_licensing?
88
+ false
87
89
  else
88
90
  true
89
91
  end
@@ -137,6 +139,10 @@ module Gitlab
137
139
  cloud_licensing_enabled == true
138
140
  end
139
141
 
142
+ def offline_cloud_licensing?
143
+ offline_cloud_licensing_enabled == true
144
+ end
145
+
140
146
  def auto_renew?
141
147
  auto_renew_enabled == true
142
148
  end
@@ -181,6 +187,7 @@ module Gitlab
181
187
  hash['activated_at'] = activated_at if activated?
182
188
 
183
189
  hash['cloud_licensing_enabled'] = cloud_licensing?
190
+ hash['offline_cloud_licensing_enabled'] = offline_cloud_licensing?
184
191
  hash['auto_renew_enabled'] = auto_renew?
185
192
  hash['seat_reconciliation_enabled'] = seat_reconciliation?
186
193
  hash['operational_metrics_enabled'] = operational_metrics?
@@ -209,7 +216,7 @@ module Gitlab
209
216
  private
210
217
 
211
218
  def load_attributes(attributes)
212
- attributes = Hash[attributes.map { |k, v| [k.to_s, v] }]
219
+ attributes = attributes.transform_keys(&:to_s)
213
220
 
214
221
  version = attributes['version'] || 1
215
222
  raise ArgumentError, 'Version is too new' unless version && version == 1
@@ -230,6 +237,7 @@ module Gitlab
230
237
 
231
238
  %w[
232
239
  cloud_licensing_enabled
240
+ offline_cloud_licensing_enabled
233
241
  auto_renew_enabled
234
242
  seat_reconciliation_enabled
235
243
  operational_metrics_enabled
@@ -240,7 +248,7 @@ module Gitlab
240
248
 
241
249
  restrictions = attributes['restrictions']
242
250
  if restrictions&.is_a?(Hash)
243
- restrictions = Hash[restrictions.map { |k, v| [k.to_sym, v] }]
251
+ restrictions = restrictions.transform_keys(&:to_sym)
244
252
  @restrictions = restrictions
245
253
  end
246
254
  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: 2.0.0
4
+ version: 2.1.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-06-23 00:00:00.000000000 Z
13
+ date: 2022-01-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler