relaton-etsi 1.20.1 → 1.20.2

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: 7eb7d28bd38802dabf44bb9829c1fafcc0684d3ac1ebeadd42cce18cc7ecec87
4
- data.tar.gz: 0e6496f3c29a8bc929ceacc333bb02d9edb87e2d795a4e91b55d525adbbc2d2c
3
+ metadata.gz: 9db12fcd09fa10052380fe87eac90777880e224594c4f47487b6010283cf5d82
4
+ data.tar.gz: b33c26ffb892562a8a46eb07f2e10cfe50d83585596f6331baa93f360894f6c5
5
5
  SHA512:
6
- metadata.gz: 859319f0d1eacbcde84a5e235ef697ef5dbe6e8edb147381b1f0c53610ea1417cf9fb200eaf3d3924de9ad8aa780118308bbcd512187e49936218076697e585e
7
- data.tar.gz: c7cd3a40a80bc5a721b937a1be63b6d64e1214404fe5be06fade0ba4ee030c94952a836f3f6e4e4f3f0d21c8d7f04c59641aa42198c8d29c0220871509ad2ee7
6
+ metadata.gz: 227db6b7da0fd223ad0f272fbf4c7da06dcbe587dc973cafd32af8d3de9a09ef0d2600f427a14f56945dac93fb5f65d486c02b7ba61ad09e659f8d36b9b49b4a
7
+ data.tar.gz: ebeec237a1f36122db9d6178201ab44b2dcc347cd0141e3b12e418d35b45f7eb31999dbf1710b911ef041964b0aeded269ff4231f17bf490292598211d3f7949
data/CLAUDE.md ADDED
@@ -0,0 +1,67 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Build and Test Commands
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ bin/setup
10
+
11
+ # Run all tests
12
+ bundle exec rake spec
13
+
14
+ # Run a single test file
15
+ bundle exec rspec spec/relaton_etsi/bibliography_spec.rb
16
+
17
+ # Run a single test by line number
18
+ bundle exec rspec spec/relaton_etsi/bibliography_spec.rb:15
19
+
20
+ # Run linter
21
+ bundle exec rubocop
22
+
23
+ # Run linter with auto-fix
24
+ bundle exec rubocop -a
25
+
26
+ # Interactive console for experimentation
27
+ bin/console
28
+ ```
29
+
30
+ ## Architecture
31
+
32
+ This gem is part of the [Relaton](https://github.com/relaton) ecosystem for retrieving and managing bibliographic data from standards organizations. It specifically handles ETSI (European Telecommunications Standards Institute) standards.
33
+
34
+ ### Core Dependencies
35
+ - `relaton-bib` - Base bibliographic classes that this gem extends
36
+ - `relaton-index` - Document indexing for search functionality
37
+
38
+ ### Key Classes
39
+
40
+ **Entry Points:**
41
+ - `Bibliography` - Main API: `RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")` searches the Relaton index and returns a `BibliographicItem`
42
+ - `Processor` - Relaton integration point, registered with the main relaton gem
43
+
44
+ **Data Model:**
45
+ - `BibliographicItem` extends `RelatonBib::BibliographicItem` with ETSI-specific fields: `marker`, `frequency`, `mandate`, `custom_collection`
46
+ - `DocumentType` - ETSI document type abbreviations (EN, ES, EG, TS, GS, GR, TR, etc.) and their full names
47
+ - `PubId` - Parser for ETSI document identifiers, extracting type, docnumber, version, edition, and date
48
+
49
+ **Data Fetching:**
50
+ - `DataFetcher` - Bulk fetches all documents from www.etsi.org CSV export
51
+ - `DataParser` - Transforms CSV rows into `BibliographicItem` objects
52
+
53
+ **Serialization:**
54
+ - `XMLParser` extends `RelatonBib::XMLParser` for ETSI-specific XML parsing
55
+ - `HashConverter` includes `RelatonBib::HashConverter` for YAML/Hash conversion
56
+
57
+ ### Data Flow
58
+ 1. `Bibliography.search` queries the GitHub-hosted index (`relaton-data-etsi`)
59
+ 2. Matching documents are fetched as YAML from the data repository
60
+ 3. `HashConverter` transforms YAML to constructor arguments
61
+ 4. `BibliographicItem` is instantiated and returned
62
+
63
+ For bulk data generation, `DataFetcher` downloads CSV from etsi.org, parses each row with `DataParser`, and saves to files.
64
+
65
+ ## Testing
66
+
67
+ Tests use VCR cassettes in `spec/vcr_cassettes/` to record/replay HTTP interactions. When updating tests that make HTTP calls, delete the relevant cassette to re-record.
@@ -34,7 +34,7 @@ module RelatonEtsi
34
34
  "title=1&etsiNumber=1&content=1&version=0&onApproval=1&published=1&withdrawn=1&historical=1&isCurrent=1&" \
35
35
  "superseded=1&startDate=1988-01-15&endDate=#{date}&harmonized=0&keyword=&TB=&stdType=&frequency=&" \
36
36
  "mandate=&collection=&sort=1&x=#{timestamp}"
37
- csv = OpenURI.open_uri(url) { |f| f.readlines.join }
37
+ csv = Mechanize.new.get(url).body
38
38
  CSV.parse(csv, headers: true, col_sep: ';', skip_lines: /sep=;/).each do |row|
39
39
  save DataParser.new(row).parse
40
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonEtsi
4
- VERSION = "1.20.1"
4
+ VERSION = "1.20.2"
5
5
  end
data/lib/relaton_etsi.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "net/http"
4
- require "open-uri"
4
+ require "mechanize"
5
5
  require "csv"
6
6
  require "relaton/index"
7
7
  require "relaton_bib"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-etsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.1
4
+ version: 1.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-06-20 00:00:00.000000000 Z
11
+ date: 2026-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: csv
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mechanize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.8'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: relaton-bib
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,6 +76,7 @@ extra_rdoc_files: []
62
76
  files:
63
77
  - ".rspec"
64
78
  - ".rubocop.yml"
79
+ - CLAUDE.md
65
80
  - LICENSE.txt
66
81
  - README.adoc
67
82
  - Rakefile