glossarist 2.2.0 → 2.2.1

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: 9111f4d1d6b0ea9180c0a61faee7fa8a823aef40b3712803757bf0cc4df76509
4
+ data.tar.gz: 47255c6c4ad7b725198d7b3f3e256e30cc2c1489d0a1a8315c84e3aabae73d32
5
5
  SHA512:
6
- metadata.gz: 2ce6fffeda48412bda622570f2eee9ae17065346a520821293f16bf2d29bb4c90674e6a0ce3a7f8e3dc75cb871c9d9308841c318739f0a942ea9d42c108b0ae9
7
- data.tar.gz: 56ff4885111df64c8fe8a179e15f73164ad1e0dd4651f63ae27685b23fbcb94ae32b1250b82e2fd99430a8fd07a7efc31fcf0f4b284364c2954c802435fea6ca
6
+ metadata.gz: 635ff3fb8d7f56a2e25968700c9b025946d4fb00ae0d8785619c438a2f4aaee5a93f82ff6022298a2c89d71da9c38d4095d215509addc1c3060b66fe9ff09bff
7
+ data.tar.gz: d04bf458f1e88b0f325e2c38403d426179e8ca33277ac1e6efe12fc85837bdddf7fd80899cc370ca1930f0a0f91da97b67aef7087009217a89b06f0d861cecbe
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
@@ -27,11 +27,11 @@ module Glossarist
27
27
  # Temporary fields
28
28
  # @todo Need to remove these once the isotc211-glossary is fixed
29
29
  attr_accessor *%i[
30
- review_date
31
- review_decision_date
32
- review_decision_event
33
- review_type
34
- ]
30
+ review_date
31
+ review_decision_date
32
+ review_decision_event
33
+ review_type
34
+ ]
35
35
 
36
36
  def language_code=(language_code)
37
37
  if language_code.is_a?(String) && language_code.length == 3
@@ -41,11 +41,10 @@ module Glossarist
41
41
  end
42
42
  end
43
43
 
44
- def to_h # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
44
+ def to_h_no_uuid # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
45
45
  hash = super
46
46
 
47
47
  hash["data"].merge!({
48
- "domain" => domain,
49
48
  "language_code" => language_code,
50
49
  "entry_status" => entry_status,
51
50
  "sources" => sources.empty? ? nil : sources&.map(&:to_h),
@@ -56,6 +55,8 @@ module Glossarist
56
55
  "review_decision_event" => review_decision_event,
57
56
  }.compact).merge!(@extension_attributes)
58
57
 
58
+ hash["status"] = entry_status if entry_status
59
+
59
60
  hash
60
61
  end
61
62
 
@@ -63,7 +64,7 @@ module Glossarist
63
64
  terms = hash["terms"]&.map { |h| Designation::Base.from_h(h) } || []
64
65
  sources = hash["authoritative_source"]&.each { |source| source.merge({ "type" => "authoritative" }) }
65
66
 
66
- super(hash.merge({"terms" => terms, "sources" => sources}))
67
+ super(hash.merge({ "terms" => terms, "sources" => sources }))
67
68
  end
68
69
 
69
70
  # @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.2.1"
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.2.1
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