gitlab-license 1.2.0 → 1.4.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: e6aecf2ddad9be921880a1603714f79947534ede972c8f47f8b5121c96d912c1
4
- data.tar.gz: 66b55835b29c3c9c2fdd175b31113523d616802e6a8cfa6898a98f080039760b
3
+ metadata.gz: f525ce304f2d85f5f03f545039dccf52dea44383c11d714f1ca3c0ed78e30905
4
+ data.tar.gz: 7f34872e6678f0c3d9970cae4077122f96864bf9f1bec0219bae35709e538082
5
5
  SHA512:
6
- metadata.gz: 1ca37a34899d853c22871e36f70aac9196e127ea92b6c7ef1cdda167eab9e595c9e092ae072857c343158881dad8961b2430150b3e730d2408facac6b94b1c1e
7
- data.tar.gz: 5d77bbd654db4ad8e4e4458748d15720a3092d6085e73e06ac717b4f5fe6594f52ed517dedcc6e4c33398f3a1f419b7573578d37dae61a0f84b3543e2557383d
6
+ metadata.gz: ca9c47b79cfb8d3b6bbb780e565eccaf3005bb0b6f44c03fc9d5836bc18ae57a4a694958a8e7e74a71d83d7ec2c83384283aa6ba34f859b6df34142fafb4318f
7
+ data.tar.gz: 1c4ed9a4bb95a8094d11f3caec70aa94fae5651931546a3ef984500e8da7dd22f6c711b8ffe646f00f93283a557317ee3f415f44fe7c0fb660dffb0e16acc9d8
@@ -50,10 +50,9 @@ module Gitlab
50
50
  end
51
51
 
52
52
  attr_reader :version
53
- attr_accessor :licensee, :starts_at, :expires_at
54
- attr_accessor :notify_admins_at, :notify_users_at, :block_changes_at
55
- attr_accessor :type, :last_synced_at, :next_sync_at, :block_changes_without_sync_at
56
- attr_accessor :restrictions
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
57
56
 
58
57
  alias_method :issued_at, :starts_at
59
58
  alias_method :issued_at=, :starts_at=
@@ -79,9 +78,9 @@ module Gitlab
79
78
  false
80
79
  elsif next_sync_at && !next_sync_at.is_a?(DateTime)
81
80
  false
82
- elsif block_changes_without_sync_at && !block_changes_without_sync_at.is_a?(Date)
81
+ elsif activated_at && !activated_at.is_a?(DateTime)
83
82
  false
84
- elsif type && type != 'sync'
83
+ elsif type && type != 'cloud'
85
84
  false
86
85
  elsif restrictions && !restrictions.is_a?(Hash)
87
86
  false
@@ -110,14 +109,14 @@ module Gitlab
110
109
  block_changes_at
111
110
  end
112
111
 
113
- def will_block_changes_without_sync?
114
- block_changes_without_sync_at
115
- end
116
-
117
112
  def will_sync?
118
113
  next_sync_at
119
114
  end
120
115
 
116
+ def activated?
117
+ activated_at
118
+ end
119
+
121
120
  def expired?
122
121
  will_expire? && Date.today >= expires_at
123
122
  end
@@ -134,10 +133,6 @@ module Gitlab
134
133
  will_block_changes? && Date.today >= block_changes_at
135
134
  end
136
135
 
137
- def block_changes_without_sync?
138
- will_block_changes_without_sync? && Date.today >= block_changes_without_sync_at
139
- end
140
-
141
136
  def restricted?(key = nil)
142
137
  if key
143
138
  restricted? && restrictions.has_key?(key)
@@ -161,9 +156,9 @@ module Gitlab
161
156
  hash['notify_users_at'] = notify_users_at if will_notify_users?
162
157
  hash['block_changes_at'] = block_changes_at if will_block_changes?
163
158
 
164
- hash['block_changes_without_sync_at'] = block_changes_without_sync_at if will_block_changes_without_sync?
165
159
  hash['next_sync_at'] = next_sync_at if will_sync?
166
160
  hash['last_synced_at'] = last_synced_at if will_sync?
161
+ hash['activated_at'] = activated_at if activated?
167
162
  hash['type'] = type
168
163
 
169
164
  hash['restrictions'] = restrictions if restricted?
@@ -196,16 +191,16 @@ module Gitlab
196
191
  @version = version
197
192
 
198
193
  @licensee = attributes['licensee']
194
+ @type = attributes['type']
199
195
 
200
196
  # `issued_at` is the legacy name for starts_at.
201
197
  # TODO: Move to starts_at in a next version.
202
- %w[issued_at expires_at notify_admins_at notify_users_at block_changes_at].each do |attr|
203
- value = attributes[attr]
204
- value = Date.parse(value) rescue nil if value.is_a?(String)
205
-
206
- next unless value
198
+ %w[issued_at expires_at notify_admins_at notify_users_at block_changes_at].each do |attr_name|
199
+ set_date_attribute(attr_name, attributes[attr_name])
200
+ end
207
201
 
208
- send("#{attr}=", value)
202
+ %w[last_synced_at next_sync_at activated_at].each do |attr_name|
203
+ set_datetime_attribute(attr_name, attributes[attr_name])
209
204
  end
210
205
 
211
206
  restrictions = attributes['restrictions']
@@ -214,5 +209,17 @@ module Gitlab
214
209
  @restrictions = restrictions
215
210
  end
216
211
  end
212
+
213
+ def set_date_attribute(attr_name, value, date_class = Date)
214
+ value = date_class.parse(value) rescue nil if value.is_a?(String)
215
+
216
+ return unless value
217
+
218
+ send("#{attr_name}=", value)
219
+ end
220
+
221
+ def set_datetime_attribute(attr_name, value)
222
+ set_date_attribute(attr_name, value, DateTime)
223
+ end
217
224
  end
218
225
  end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  class License
3
- VERSION = '1.2.0'.freeze
3
+ VERSION = '1.4.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.2.0
4
+ version: 1.4.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: 2020-11-17 00:00:00.000000000 Z
13
+ date: 2021-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler