glossarist 2.2.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d174478d1fdc030866f09175b1a229e7133ea77005fa00f7b3f46a904a12248e
4
- data.tar.gz: 54fb2bfcbb816f5514d3bc0c54f3fd37debdbb87af2279b117edffaa3ea77aa7
3
+ metadata.gz: fe8b9555663cedc2258a960b19a10f9d6fc4575faf70006e1223c69f95678451
4
+ data.tar.gz: fbdd27366d93b637882ad7dd3b77bfbaca9ae68c489403d7595fbe39af901e68
5
5
  SHA512:
6
- metadata.gz: 2ce6fffeda48412bda622570f2eee9ae17065346a520821293f16bf2d29bb4c90674e6a0ce3a7f8e3dc75cb871c9d9308841c318739f0a942ea9d42c108b0ae9
7
- data.tar.gz: 56ff4885111df64c8fe8a179e15f73164ad1e0dd4651f63ae27685b23fbcb94ae32b1250b82e2fd99430a8fd07a7efc31fcf0f4b284364c2954c802435fea6ca
6
+ metadata.gz: 2e7030a8e328ee775641e8c4637b458c6746b872d597235bad00977c78a97d56f21ed48bbb9ef11ab0209ba74a93f7aeac19121bca32bd8c71aecdf67601223b
7
+ data.tar.gz: 1a5ddbc5c71542eb7f258d17c601cd08b54041053ddfb1089a5f6e7eca28dfb360fe2b1c21da4bfa9d8474c333ce37376aeccbf75fc609dd2cea3e2e28c1acd2
data/Gemfile CHANGED
@@ -2,4 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ gem "pry", "~> 0.14.0"
6
+ gem "rake", "~> 13.0"
7
+ gem "rspec", "~> 3.10"
8
+
5
9
  gemspec
data/glossarist.gemspec CHANGED
@@ -30,10 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "relaton", "~> 1.16"
33
+ spec.add_dependency "relaton", "~> 1.19"
34
34
  spec.add_dependency "thor"
35
-
36
- spec.add_development_dependency "pry", "~> 0.14.0"
37
- spec.add_development_dependency "rake", "~> 13.0"
38
- spec.add_development_dependency "rspec", "~> 3.10"
39
35
  end
@@ -69,12 +69,12 @@ module Glossarist
69
69
  def uuid
70
70
  @uuid ||= Glossarist::Utilities::UUID.uuid_v5(
71
71
  Glossarist::Utilities::UUID::OID_NAMESPACE,
72
- to_h.to_yaml,
72
+ to_h_no_uuid.to_yaml,
73
73
  )
74
74
  end
75
75
 
76
76
  def id=(id)
77
- # Some of the glossaries that are not generated using glossarist, contains ids that are integers
77
+ # Some of the glossaries that are not generated using glossarist, contains ids that are integers
78
78
  # so adding a temporary check until every glossary is updated using glossarist.
79
79
  if !id.nil? && (id.is_a?(String) || id.is_a?(Integer))
80
80
  @id = id
@@ -82,6 +82,7 @@ module Glossarist
82
82
  raise(Glossarist::Error, "Expect id to be a String or Integer, Got #{id.class} (#{id})")
83
83
  end
84
84
  end
85
+
85
86
  alias :termid= :id=
86
87
  alias :identifier= :id=
87
88
 
@@ -119,6 +120,7 @@ module Glossarist
119
120
  def preferred_designations
120
121
  @designations.select(&:preferred?)
121
122
  end
123
+
122
124
  alias :preferred_terms :preferred_designations
123
125
 
124
126
  def dates=(dates)
@@ -141,7 +143,22 @@ module Glossarist
141
143
  end
142
144
  end
143
145
 
144
- def to_h
146
+ def date_accepted=(date)
147
+ date_hash = {
148
+ "type" => "accepted",
149
+ "date" => date,
150
+ }
151
+
152
+ @dates ||= []
153
+ @dates << ConceptDate.new(date_hash)
154
+ end
155
+
156
+ def date_accepted
157
+ return nil unless @dates
158
+ @dates.find { |date| date.accepted? }
159
+ end
160
+
161
+ def to_h_no_uuid
145
162
  {
146
163
  "data" => {
147
164
  "dates" => dates&.map(&:to_h),
@@ -154,10 +171,18 @@ module Glossarist
154
171
  "sources" => sources.empty? ? nil : sources&.map(&:to_h),
155
172
  "terms" => (terms&.map(&:to_h) || []),
156
173
  "related" => related&.map(&:to_h),
174
+ "domain" => domain,
157
175
  }.compact,
176
+
177
+ "date_accepted" => date_accepted&.date,
178
+
158
179
  }.compact
159
180
  end
160
181
 
182
+ def to_h
183
+ to_h_no_uuid.merge("id" => uuid)
184
+ end
185
+
161
186
  # @deprecated For legacy reasons only.
162
187
  # Implicit conversion (i.e. {#to_hash} alias) will be removed soon.
163
188
  alias :to_hash :to_h
@@ -16,6 +16,7 @@ module Glossarist
16
16
  # @note Works with strings, but soon they may be replaced with symbols.
17
17
  # @return [String]
18
18
  attr_accessor :entry_status
19
+ alias_method :status=, :entry_status=
19
20
 
20
21
  # Must be one of the following:
21
22
  # +preferred+, +admitted+, +deprecated+.
@@ -27,11 +28,11 @@ module Glossarist
27
28
  # Temporary fields
28
29
  # @todo Need to remove these once the isotc211-glossary is fixed
29
30
  attr_accessor *%i[
30
- review_date
31
- review_decision_date
32
- review_decision_event
33
- review_type
34
- ]
31
+ review_date
32
+ review_decision_date
33
+ review_decision_event
34
+ review_type
35
+ ]
35
36
 
36
37
  def language_code=(language_code)
37
38
  if language_code.is_a?(String) && language_code.length == 3
@@ -41,11 +42,10 @@ module Glossarist
41
42
  end
42
43
  end
43
44
 
44
- def to_h # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
45
+ def to_h_no_uuid # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
45
46
  hash = super
46
47
 
47
48
  hash["data"].merge!({
48
- "domain" => domain,
49
49
  "language_code" => language_code,
50
50
  "entry_status" => entry_status,
51
51
  "sources" => sources.empty? ? nil : sources&.map(&:to_h),
@@ -56,6 +56,8 @@ module Glossarist
56
56
  "review_decision_event" => review_decision_event,
57
57
  }.compact).merge!(@extension_attributes)
58
58
 
59
+ hash["status"] = entry_status if entry_status
60
+
59
61
  hash
60
62
  end
61
63
 
@@ -63,7 +65,7 @@ module Glossarist
63
65
  terms = hash["terms"]&.map { |h| Designation::Base.from_h(h) } || []
64
66
  sources = hash["authoritative_source"]&.each { |source| source.merge({ "type" => "authoritative" }) }
65
67
 
66
- super(hash.merge({"terms" => terms, "sources" => sources}))
68
+ super(hash.merge({ "terms" => terms, "sources" => sources }))
67
69
  end
68
70
 
69
71
  # @deprecated For legacy reasons only.
@@ -4,5 +4,5 @@
4
4
  #
5
5
 
6
6
  module Glossarist
7
- VERSION = "2.2.0"
7
+ VERSION = "2.3.0"
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glossarist
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-18 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '1.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '1.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,48 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.14.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.14.0
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '13.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '13.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.10'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.10'
83
41
  description:
84
42
  email:
85
43
  - open.source@ribose.com