code0-license 0.3.0 → 0.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: 9b31c49c94ebb8a5d019f33114cb5b4c14a679a86824b48b3e96cb0e5eb837cd
4
- data.tar.gz: 8ada22784f937ac2052a45176709c0f7cc4b07cd592cf4c346395633f00811f5
3
+ metadata.gz: 40b0c32aa435aa020ec267d3946ea3701bc8e581004ccefe37abcf04e08cdfb8
4
+ data.tar.gz: 5219aacaae6db52ea1c885d250c89dd3cad6bc7430326d790eecf66f4c0943b6
5
5
  SHA512:
6
- metadata.gz: 9017c312c7d3e2e66cfab92483b42eb24423aa1db0bcb2db300d32bd92fe522c2d228538f13ff71133f28351af43cc8e18965c8ca7291be700ab8e1ed96bbeff
7
- data.tar.gz: 57a55a96fafb50fde8caf7d6c71af8cb01531a4b5181550ab71eda2acb05326625691505382b7bd6c7e23827a93e38d251282987431d505648c43cd7b93e3d5a
6
+ metadata.gz: 7353b46da78ca6d8ea3608120ef895c0148486c0700f6cf0ab4dcb36f8ef6d0833c9356a43372e1380c84645f2354e4446a8f61adad4f83613b9bebb13014e0b
7
+ data.tar.gz: caa6df4e58e9ae251ea43928feee55005acea1df32464a7d88382433d1a654ea99fbe72df59501454fd15f7959bd5637764b4c6ea15f7622d0bf7fb6bd59aad2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code0-license (0.3.0)
4
+ code0-license (0.4.0)
5
5
  base64 (~> 0.3.0)
6
6
 
7
7
  GEM
data/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ Copyright 2023-2026 Code0 UG (haftungsbeschränkt)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ AI Usage Restriction: Notwithstanding the permissions granted above, this Software and its source code may not be used, in whole or in part, for the purpose of training, fine-tuning, or developing artificial intelligence (AI) models or machine learning algorithms without prior written consent from the Copyright Holder.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Code0
4
4
  class License
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
data/lib/code0/license.rb CHANGED
@@ -47,6 +47,7 @@ module Code0
47
47
  ATTRIBUTES = %i[
48
48
  start_date
49
49
  end_date
50
+ grace_period_days
50
51
  licensee
51
52
  restrictions
52
53
  options
@@ -61,16 +62,17 @@ module Code0
61
62
  return false if !licensee || !licensee.is_a?(Hash) || licensee.empty?
62
63
  return false if !start_date || !start_date.is_a?(Date)
63
64
  return false if (!end_date || !end_date.is_a?(Date)) && !options[:allow_missing_end_date]
65
+ return false if grace_period_days.nil? || !grace_period_days.is_a?(Integer)
64
66
 
65
67
  true
66
68
  end
67
69
 
68
- def in_active_time?
70
+ def in_active_time?(allow_grace_period: true)
69
71
  return false if start_date > Date.today
70
72
  return true if !end_date && options[:allow_missing_end_date]
71
73
  return false if !end_date && !options[:allow_missing_end_date]
72
74
 
73
- end_date >= Date.today
75
+ end_date + (allow_grace_period ? grace_period_days : 0) >= Date.today
74
76
  end
75
77
 
76
78
  def restricted?(attribute)
@@ -92,6 +94,7 @@ module Code0
92
94
  send("#{property}=", value)
93
95
  end
94
96
 
97
+ send("grace_period_days=", data[:grace_period_days] || 0)
95
98
  send("licensee=", data[:licensee])
96
99
  send("restrictions=", data[:restrictions] || {})
97
100
  send("options=", data[:options] || {})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code0-license
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niklas van Schrick
@@ -104,7 +104,7 @@ files:
104
104
  - ".tool-versions"
105
105
  - Gemfile
106
106
  - Gemfile.lock
107
- - LICENSE.txt
107
+ - LICENSE
108
108
  - README.md
109
109
  - Rakefile
110
110
  - keys/.keep
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024 Niklas van Schrick
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.