relaton-iec 2.0.0 → 2.1.1
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 +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/CLAUDE.md +13 -0
- data/Gemfile +1 -0
- data/README.adoc +2 -0
- data/Rakefile +22 -0
- data/grammars/biblio.rng +4 -8
- data/lib/relaton/iec/hit.rb +1 -1
- data/lib/relaton/iec/model/bibdata.rb +1 -0
- data/lib/relaton/iec/model/bibitem.rb +1 -0
- data/lib/relaton/iec/model/docidentifier.rb +63 -37
- data/lib/relaton/iec/model/ext.rb +16 -13
- data/lib/relaton/iec/model/item.rb +4 -8
- data/lib/relaton/iec/model/item_base.rb +5 -2
- data/lib/relaton/iec/model/relation.rb +1 -1
- data/lib/relaton/iec/version.rb +1 -1
- data/{relaton_iec.gemspec → relaton-iec.gemspec} +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7ec248ce4ccbda30b47e48cc530425476eb5b0b5d3e908614717d2c0f6cbb1b
|
|
4
|
+
data.tar.gz: 85f6a7b53e79549f1b5e4aba8521db64fd415336a6ef95c344244bdb4b1015af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2453f2e4e3b1f912f738bf2abb32efc34eb261f9c9507215fe47822c6948d5cc3486cc721f9b2fb09164b497c61fd73aefd1344bc2334d08b4ec02efc89252f
|
|
7
|
+
data.tar.gz: 478e1f5a249c5811957bdd6f5af09cd13f94ba4482e9549ce5a83f0c247d9a9f891a305a845377a3dc6112d3a8e2a1ed5226617c66a45722e73c6c5b29c8e8c9
|
data/.github/workflows/rake.yml
CHANGED
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Development
|
|
4
|
+
|
|
5
|
+
- `bundle install` — install dependencies
|
|
6
|
+
- `bundle exec rake spec` — run tests
|
|
7
|
+
- `bundle exec rubocop` — lint
|
|
8
|
+
|
|
9
|
+
## Testing
|
|
10
|
+
|
|
11
|
+
- **Framework:** RSpec with VCR cassettes and WebMock
|
|
12
|
+
- **Index fixture:** `spec/fixtures/index-v1.zip` is pre-loaded into `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-iec.
|
|
13
|
+
- **VCR cassettes:** `spec/vcr_cassettes/` — index download requests are ignored by VCR (handled by fixture).
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
|
@@ -286,6 +286,8 @@ Relaton::Iec uses the relaton-logger gem for logging. By default, it logs to STD
|
|
|
286
286
|
|
|
287
287
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
288
288
|
|
|
289
|
+
To update the index test fixture (used by tests), run `rake spec:update_index`. This downloads the latest `index-v1.zip` from the https://github.com/relaton/relaton-data-iec[relaton-data-iec] repository.
|
|
290
|
+
|
|
289
291
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
290
292
|
|
|
291
293
|
|
data/Rakefile
CHANGED
|
@@ -4,3 +4,25 @@ require "rspec/core/rake_task"
|
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
|
6
6
|
task :default => :spec
|
|
7
|
+
|
|
8
|
+
namespace :spec do
|
|
9
|
+
desc "Download latest IEC index fixture from relaton-data-iec"
|
|
10
|
+
task :update_index do
|
|
11
|
+
require "net/http"
|
|
12
|
+
require "uri"
|
|
13
|
+
|
|
14
|
+
url = "https://raw.githubusercontent.com/relaton/relaton-data-iec/v2/index-v1.zip"
|
|
15
|
+
dest = File.join(__dir__, "spec", "fixtures", "index-v1.zip")
|
|
16
|
+
|
|
17
|
+
puts "Downloading \#{url} ..."
|
|
18
|
+
uri = URI.parse(url)
|
|
19
|
+
response = Net::HTTP.get_response(uri)
|
|
20
|
+
|
|
21
|
+
if response.is_a?(Net::HTTPSuccess)
|
|
22
|
+
File.binwrite(dest, response.body)
|
|
23
|
+
puts "Updated \#{dest} (\#{response.body.bytesize} bytes)"
|
|
24
|
+
else
|
|
25
|
+
abort "Failed to download: HTTP \#{response.code}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/grammars/biblio.rng
CHANGED
|
@@ -2015,15 +2015,11 @@ provided that it is not the entire bibliographic item that is so related</a:docu
|
|
|
2015
2015
|
<a:documentation>A version of the bibliographic item (within an edition). Can be used for drafts</a:documentation>
|
|
2016
2016
|
<element name="version">
|
|
2017
2017
|
<optional>
|
|
2018
|
-
<
|
|
2019
|
-
<a:documentation>
|
|
2020
|
-
</
|
|
2021
|
-
</optional>
|
|
2022
|
-
<optional>
|
|
2023
|
-
<ref name="draft">
|
|
2024
|
-
<a:documentation>The identifier for the current draft of the bibliographic item</a:documentation>
|
|
2025
|
-
</ref>
|
|
2018
|
+
<attribute name="type">
|
|
2019
|
+
<a:documentation>Versioning scheme, in case of multiple versioning schemes</a:documentation>
|
|
2020
|
+
</attribute>
|
|
2026
2021
|
</optional>
|
|
2022
|
+
<text/>
|
|
2027
2023
|
</element>
|
|
2028
2024
|
</define>
|
|
2029
2025
|
<define name="vedition">
|
data/lib/relaton/iec/hit.rb
CHANGED
|
@@ -1,74 +1,100 @@
|
|
|
1
1
|
module Relaton
|
|
2
2
|
module Iec
|
|
3
|
-
class
|
|
4
|
-
|
|
5
|
-
def cast(value)
|
|
6
|
-
value.is_a?(String) ? ::Pubid::Iec::Identifier.parse(value) : value
|
|
7
|
-
rescue StandardError
|
|
8
|
-
Util.warn "Failed to parse Pubid: #{value}"
|
|
9
|
-
value
|
|
10
|
-
end
|
|
11
|
-
end
|
|
3
|
+
class Docidentifier < Bib::Docidentifier
|
|
4
|
+
attribute :content, :string
|
|
12
5
|
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
attr_reader :pubid
|
|
7
|
+
|
|
8
|
+
def initialize(arg = nil, **kwargs)
|
|
9
|
+
arg.is_a?(Hash) ? super(arg) : super(**kwargs)
|
|
10
|
+
raw = arg.is_a?(Hash) ? (arg["content"] || arg[:content]) : kwargs[:content]
|
|
11
|
+
self.content = raw if raw
|
|
15
12
|
end
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
14
|
+
alias_method :original_content=, :content=
|
|
15
|
+
alias_method :original_content, :content
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
def content=(value)
|
|
18
|
+
@pubid = nil
|
|
19
|
+
@raw_content = nil
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
parsed =
|
|
22
|
+
case value
|
|
23
|
+
when ::Pubid::Iec::Base then value
|
|
24
|
+
when String
|
|
25
|
+
begin
|
|
26
|
+
::Pubid::Iec::Identifier.parse(value)
|
|
27
|
+
rescue StandardError
|
|
28
|
+
Util.warn "Failed to parse Pubid: #{value}"
|
|
29
|
+
nil
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if parsed
|
|
34
|
+
@pubid = parsed
|
|
35
|
+
elsif value.is_a?(String)
|
|
36
|
+
@raw_content = value
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
send(:original_content=, to_s)
|
|
26
40
|
end
|
|
27
41
|
|
|
28
|
-
def
|
|
29
|
-
|
|
42
|
+
def content
|
|
43
|
+
return @raw_content if @raw_content
|
|
44
|
+
return render_pubid(@pubid) if @pubid
|
|
45
|
+
|
|
46
|
+
original_content
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def to_s
|
|
50
|
+
content.to_s
|
|
30
51
|
end
|
|
31
52
|
|
|
32
53
|
def to_all_parts!
|
|
33
|
-
|
|
34
|
-
Util.warn "Cannot convert String to all parts: #{content}"
|
|
35
|
-
return
|
|
36
|
-
end
|
|
54
|
+
return unless @pubid
|
|
37
55
|
|
|
38
56
|
remove_part!
|
|
39
57
|
remove_date!
|
|
40
58
|
remove_stage!
|
|
41
|
-
|
|
59
|
+
@pubid.all_parts = true if @pubid.respond_to?(:all_parts=)
|
|
60
|
+
refresh_content!
|
|
42
61
|
end
|
|
43
62
|
|
|
44
63
|
def remove_stage!
|
|
45
|
-
remove_attr!
|
|
64
|
+
remove_attr!(:stage)
|
|
46
65
|
end
|
|
47
66
|
|
|
48
67
|
def remove_part!
|
|
49
|
-
remove_attr!
|
|
68
|
+
remove_attr!(:part)
|
|
50
69
|
end
|
|
51
70
|
|
|
52
71
|
def remove_date!
|
|
53
|
-
remove_attr!
|
|
72
|
+
remove_attr!(:year)
|
|
54
73
|
end
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
return content if content.is_a? String
|
|
75
|
+
private
|
|
58
76
|
|
|
77
|
+
def render_pubid(pubid)
|
|
59
78
|
case type
|
|
60
|
-
when "URN" then
|
|
61
|
-
else
|
|
79
|
+
when "URN" then pubid.urn
|
|
80
|
+
else pubid.to_s
|
|
62
81
|
end
|
|
63
82
|
end
|
|
64
83
|
|
|
65
|
-
private
|
|
66
|
-
|
|
67
84
|
def remove_attr!(attr)
|
|
68
|
-
return
|
|
85
|
+
return unless @pubid
|
|
86
|
+
|
|
87
|
+
@pubid.send("#{attr}=", nil)
|
|
88
|
+
base = @pubid.base
|
|
89
|
+
while base
|
|
90
|
+
base.send("#{attr}=", nil)
|
|
91
|
+
base = base.base
|
|
92
|
+
end
|
|
93
|
+
refresh_content!
|
|
94
|
+
end
|
|
69
95
|
|
|
70
|
-
|
|
71
|
-
|
|
96
|
+
def refresh_content!
|
|
97
|
+
send(:original_content=, to_s)
|
|
72
98
|
end
|
|
73
99
|
end
|
|
74
100
|
end
|
|
@@ -3,11 +3,10 @@ require_relative "stage_name"
|
|
|
3
3
|
|
|
4
4
|
module Relaton
|
|
5
5
|
module Iec
|
|
6
|
-
class Ext <
|
|
7
|
-
attribute :schema_version, method: :get_schema_version
|
|
6
|
+
class Ext < Bib::Ext
|
|
8
7
|
attribute :doctype, Doctype
|
|
9
8
|
attribute :subdoctype, :string, values: %w[specification method-of-test vocabulary code-of-practice]
|
|
10
|
-
attribute :
|
|
9
|
+
attribute :structuredidentifier, Iso::StructuredIdentifier
|
|
11
10
|
attribute :horizontal, :boolean
|
|
12
11
|
attribute :stagename, StageName
|
|
13
12
|
attribute :updates_document_type, :string, values: Doctype::TYPES
|
|
@@ -18,15 +17,9 @@ module Relaton
|
|
|
18
17
|
attribute :cen_processing, :boolean
|
|
19
18
|
attribute :secretary, :string
|
|
20
19
|
attribute :interest_to_committees, :string
|
|
21
|
-
attribute :ics, Bib::ICS, collection: true
|
|
22
|
-
attribute :structuredidentifier, Iso::StructuredIdentifier
|
|
23
20
|
attribute :tc_sc_officers_note, :string, raw: true
|
|
24
21
|
|
|
25
22
|
xml do
|
|
26
|
-
map_attribute "schema-version", to: :schema_version
|
|
27
|
-
map_element "doctype", to: :doctype
|
|
28
|
-
map_element "subdoctype", to: :subdoctype
|
|
29
|
-
map_element "flavor", to: :flavor
|
|
30
23
|
map_element "horizontal", to: :horizontal
|
|
31
24
|
map_element "stagename", to: :stagename
|
|
32
25
|
map_element "updates-document-type", to: :updates_document_type
|
|
@@ -37,14 +30,24 @@ module Relaton
|
|
|
37
30
|
map_element "cen-processing", to: :cen_processing
|
|
38
31
|
map_element "secretary", to: :secretary
|
|
39
32
|
map_element "interest-to-committees", to: :interest_to_committees
|
|
40
|
-
map_element "ics", to: :ics
|
|
41
|
-
map_element "structuredidentifier", to: :structuredidentifier
|
|
42
33
|
map_element "tc-sc-officers-note", to: :tc_sc_officers_note
|
|
43
34
|
end
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
key_value do
|
|
37
|
+
map_element "horizontal", to: :horizontal
|
|
38
|
+
map_element "stagename", to: :stagename
|
|
39
|
+
map_element "updates_document_type", to: :updates_document_type
|
|
40
|
+
map_element "fast_track", to: :fast_track
|
|
41
|
+
map_element "price_code", to: :price_code
|
|
42
|
+
map_element "function", to: :function
|
|
43
|
+
map_element "accessibility_color_inside", to: :accessibility_color_inside
|
|
44
|
+
map_element "cen_processing", to: :cen_processing
|
|
45
|
+
map_element "secretary", to: :secretary
|
|
46
|
+
map_element "interest_to_committees", to: :interest_to_committees
|
|
47
|
+
map_element "tc_sc_officers_note", to: :tc_sc_officers_note
|
|
47
48
|
end
|
|
49
|
+
|
|
50
|
+
def get_schema_version = Relaton.schema_versions["relaton-model-iec"]
|
|
48
51
|
end
|
|
49
52
|
end
|
|
50
53
|
end
|
|
@@ -3,10 +3,14 @@ require_relative "ext"
|
|
|
3
3
|
|
|
4
4
|
module Relaton
|
|
5
5
|
module Iec
|
|
6
|
+
class Relation < Bib::Relation
|
|
7
|
+
end
|
|
8
|
+
|
|
6
9
|
class Item < Iso::Item
|
|
7
10
|
model ItemData
|
|
8
11
|
|
|
9
12
|
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
13
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
10
14
|
attribute :ext, Ext
|
|
11
15
|
end
|
|
12
16
|
end
|
|
@@ -14,11 +18,3 @@ end
|
|
|
14
18
|
|
|
15
19
|
require_relative "item_base"
|
|
16
20
|
require_relative "relation"
|
|
17
|
-
|
|
18
|
-
module Relaton
|
|
19
|
-
module Iec
|
|
20
|
-
class Item
|
|
21
|
-
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
require_relative "docidentifier"
|
|
2
|
+
|
|
1
3
|
module Relaton
|
|
2
4
|
module Iec
|
|
3
|
-
class ItemBase <
|
|
5
|
+
class ItemBase < Iso::ItemBase
|
|
4
6
|
model ItemData
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
9
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
7
10
|
end
|
|
8
11
|
end
|
|
9
12
|
end
|
data/lib/relaton/iec/version.rb
CHANGED
|
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.add_dependency "pubid-iec", "~> 1.15.11"
|
|
29
29
|
spec.add_dependency "relaton-core", "~> 0.0.13"
|
|
30
30
|
spec.add_dependency "relaton-index", "~> 0.2.20"
|
|
31
|
-
spec.add_dependency "relaton-iso", "~> 2.
|
|
31
|
+
spec.add_dependency "relaton-iso", "~> 2.1.0"
|
|
32
32
|
spec.add_dependency "rubyzip"
|
|
33
33
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-05-06 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: addressable
|
|
@@ -85,14 +86,14 @@ dependencies:
|
|
|
85
86
|
requirements:
|
|
86
87
|
- - "~>"
|
|
87
88
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 2.
|
|
89
|
+
version: 2.1.0
|
|
89
90
|
type: :runtime
|
|
90
91
|
prerelease: false
|
|
91
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
93
|
requirements:
|
|
93
94
|
- - "~>"
|
|
94
95
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 2.
|
|
96
|
+
version: 2.1.0
|
|
96
97
|
- !ruby/object:Gem::Dependency
|
|
97
98
|
name: rubyzip
|
|
98
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,6 +121,7 @@ files:
|
|
|
120
121
|
- ".gitignore"
|
|
121
122
|
- ".rspec"
|
|
122
123
|
- ".rubocop.yml"
|
|
124
|
+
- CLAUDE.md
|
|
123
125
|
- Gemfile
|
|
124
126
|
- LICENSE.txt
|
|
125
127
|
- README.adoc
|
|
@@ -152,11 +154,12 @@ files:
|
|
|
152
154
|
- lib/relaton/iec/statuses.yml
|
|
153
155
|
- lib/relaton/iec/util.rb
|
|
154
156
|
- lib/relaton/iec/version.rb
|
|
155
|
-
-
|
|
157
|
+
- relaton-iec.gemspec
|
|
156
158
|
homepage: https://github.com/relaton/relaton-iec
|
|
157
159
|
licenses:
|
|
158
160
|
- MIT
|
|
159
161
|
metadata: {}
|
|
162
|
+
post_install_message:
|
|
160
163
|
rdoc_options: []
|
|
161
164
|
require_paths:
|
|
162
165
|
- lib
|
|
@@ -171,7 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
174
|
- !ruby/object:Gem::Version
|
|
172
175
|
version: '0'
|
|
173
176
|
requirements: []
|
|
174
|
-
rubygems_version: 3.
|
|
177
|
+
rubygems_version: 3.5.22
|
|
178
|
+
signing_key:
|
|
175
179
|
specification_version: 4
|
|
176
180
|
summary: 'Relaton::Iec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
|
|
177
181
|
model'
|