relaton-nist 0.2.3 → 0.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
  SHA1:
3
- metadata.gz: '09e8864fd84f2638653bf2de8ad8a97839020201'
4
- data.tar.gz: ac1ed9a3c13a5e24a46452075b08d71bf04271d7
3
+ metadata.gz: 860bed641e26ef2dd9e431c754d38d0dffb81a69
4
+ data.tar.gz: e7a3cddcdab9e27866ff220374bd73d6f3253b0f
5
5
  SHA512:
6
- metadata.gz: 3ceb50427aa4ab2376730b8ae38f8e487e0584d254577b4fc79a0bcb3ebc221d151e5a64bcb4279317ec2331afb47a712774ef4e2e0749af829712f1c22107b0
7
- data.tar.gz: d8a267a1d314e6d98a64961b781c5c181e4d455f21ade2ade2b17e31b64d6f44f66e75174d25cf15260834a481420196cf0700f6b532c8c9751db135a4793bee
6
+ metadata.gz: 8afdc827eaa9d984bf344138f7965099fbb7ec717cb283f2ab5d5cfa2feb910432f26fd1d22608c9de3e3364d8706acbb0d55419382808610e050c40a35065e9
7
+ data.tar.gz: 01e02e9dfd1b33d0ed24ae1b7f8181637c77ed7694fc725092882ca327044219bc8871a70999808bcd4c93890994cf39705ea43d9b48059357265b3099e1c88e
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+ pubs-export.json
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-nist (0.2.3)
5
- relaton-bib (~> 0.2.0)
4
+ relaton-nist (0.3.0)
5
+ relaton-bib (~> 0.3.0)
6
6
  rubyzip
7
7
 
8
8
  GEM
@@ -35,7 +35,7 @@ GEM
35
35
  pry (~> 0.10)
36
36
  public_suffix (3.1.1)
37
37
  rake (10.5.0)
38
- relaton-bib (0.2.5)
38
+ relaton-bib (0.3.0)
39
39
  addressable
40
40
  nokogiri (~> 1.10)
41
41
  rspec (3.8.0)
@@ -146,6 +146,7 @@ module RelatonNist
146
146
  if !ctime || ctime < resp.last_modified
147
147
  @data = nil
148
148
  zip = OpenURI.open_uri "https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.zip"
149
+ zip.close
149
150
  FileUtils.mv zip.path, DATAFILE
150
151
  end
151
152
  end
@@ -33,17 +33,17 @@ module RelatonNist
33
33
  # @param keyword [Array<RelatonNist::Keyword>]
34
34
  # @param commentperiod [RelatonNist::CommentPeriod]
35
35
  #
36
- # @param dates [Array<Hash>]
37
- # @option dates [String] :type
38
- # @option dates [String] :from
39
- # @option dates [String] :to
36
+ # @param date [Array<Hash>]
37
+ # @option date [String] :type
38
+ # @option date [String] :from
39
+ # @option date [String] :to
40
40
  #
41
- # @param contributors [Array<Hash>]
42
- # @option contributors [String] :type
43
- # @option contributors [String] :from
44
- # @option contributirs [String] :to
45
- # @option contributors [String] :abbreviation
46
- # @option contributors [Array<String>] :roles
41
+ # @param contributor [Array<Hash>]
42
+ # @option contributor [String] :type
43
+ # @option contributor [String] :from
44
+ # @option contributor [String] :to
45
+ # @option contributor [String] :abbreviation
46
+ # @option contributor [Array<String>] :role
47
47
  #
48
48
  # @param abstract [Array<Hash>]
49
49
  # @option abstract [String] :content
@@ -51,10 +51,10 @@ module RelatonNist
51
51
  # @option abstract [String] :script
52
52
  # @option abstract [String] :type
53
53
  #
54
- # @param relations [Array<Hash>]
55
- # @option relations [String] :type
56
- # @option relations [RelatonBib::BibliographicItem] :bibitem
57
- # @option relations [Array<RelatonBib::BibItemLocality>] :bib_locality
54
+ # @param relation [Array<Hash>]
55
+ # @option relation [String] :type
56
+ # @option relation [RelatonBib::BibliographicItem] :bibitem
57
+ # @option relation [Array<RelatonBib::BibItemLocality>] :bib_locality
58
58
  def initialize(**args)
59
59
  @doctype = args.delete(:doctype) || "standard"
60
60
  @keyword = args.delete(:keyword) || []
@@ -91,16 +91,16 @@ module RelatonNist
91
91
  result.each_slice(3) do |s| # ISO website only allows 3 connections
92
92
  fetch_pages(s, 3).each_with_index do |r, _i|
93
93
  if opts[:issued_date]
94
- ids = r.dates.select { |d| d.type == "issued" && d.on == opts[:issued_date] }
94
+ ids = r.date.select { |d| d.type == "issued" && d.on == opts[:issued_date] }
95
95
  next if ids.empty?
96
96
  elsif opts[:updated_date]
97
- pds = r.dates.select { |d| d.type == "published" && d.on == opts[:updated_date] }
97
+ pds = r.date.select { |d| d.type == "published" && d.on == opts[:updated_date] }
98
98
  next if pds.empty?
99
99
  end
100
100
  next if iter && r.status.iteration != iteration
101
101
  return { ret: r } if !year
102
102
 
103
- r.dates.select { |d| d.type == "published" }.each do |d|
103
+ r.date.select { |d| d.type == "published" }.each do |d|
104
104
  return { ret: r } if year.to_i == d.on.year
105
105
 
106
106
  missed_years << d.on.year
@@ -26,7 +26,7 @@ module RelatonNist
26
26
  end
27
27
  item_data[:fetched] = Date.today.to_s
28
28
  item_data[:type] = "standard"
29
- item_data[:titles] = titles
29
+ item_data[:title] = titles
30
30
  item_data[:doctype] = doctype
31
31
 
32
32
  NistBibliographicItem.new(**item_data)
@@ -39,15 +39,15 @@ module RelatonNist
39
39
  {
40
40
  link: fetch_link(json),
41
41
  docid: fetch_docid(json["docidentifier"]),
42
- dates: fetch_dates(json, hit_data[:release_date]),
43
- contributors: fetch_contributors(json),
42
+ date: fetch_dates(json, hit_data[:release_date]),
43
+ contributor: fetch_contributors(json),
44
44
  edition: fetch_edition(json),
45
45
  language: [json["language"]],
46
46
  script: [json["script"]],
47
47
  # abstract: fetch_abstract(doc),
48
48
  docstatus: fetch_status(json, hit_data[:status]),
49
49
  copyright: fetch_copyright(json["published-date"]),
50
- relations: fetch_relations_json(json),
50
+ relation: fetch_relations_json(json),
51
51
  # series: fetch_series(json),
52
52
  keyword: fetch_keywords(json),
53
53
  commentperiod: fetch_commentperiod_json(json),
@@ -60,15 +60,15 @@ module RelatonNist
60
60
  # id: fetch_id(doc),
61
61
  link: fetch_link(doc),
62
62
  docid: fetch_docid(doc),
63
- dates: fetch_dates(doc, hit_data[:release_date]),
64
- contributors: fetch_contributors(doc),
63
+ date: fetch_dates(doc, hit_data[:release_date]),
64
+ contributor: fetch_contributors(doc),
65
65
  edition: fetch_edition(hit_data[:code]),
66
66
  language: ["en"],
67
67
  script: ["Latn"],
68
68
  abstract: fetch_abstract(doc),
69
69
  docstatus: fetch_status(doc, hit_data[:status]),
70
70
  copyright: fetch_copyright(doc),
71
- relations: fetch_relations(doc),
71
+ relation: fetch_relations(doc),
72
72
  series: fetch_series(doc),
73
73
  keyword: fetch_keywords(doc),
74
74
  commentperiod: fetch_commentperiod(doc),
@@ -285,8 +285,8 @@ module RelatonNist
285
285
  def full_name(name, lang, script)
286
286
  RelatonBib::FullName.new(
287
287
  surname: RelatonBib::LocalizedString.new(name["surname"], lang, script),
288
- forenames: name_parts(name["givenName"], lang, script),
289
- additions: name_parts(name["suffix"], lang, script),
288
+ forename: name_parts(name["givenName"], lang, script),
289
+ addition: name_parts(name["suffix"], lang, script),
290
290
  prefix: name_parts(name["title"], lang, script),
291
291
  completename: RelatonBib::LocalizedString.new(name["fullName"], lang, script),
292
292
  )
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "0.2.3".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
data/relaton_nist.gemspec CHANGED
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "vcr"
36
36
  spec.add_development_dependency "webmock"
37
37
 
38
- spec.add_dependency "relaton-bib", "~> 0.2.0"
38
+ spec.add_dependency "relaton-bib", "~> 0.3.0"
39
39
  spec.add_dependency "rubyzip"
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-nist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-22 00:00:00.000000000 Z
11
+ date: 2019-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.2.0
173
+ version: 0.3.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.2.0
180
+ version: 0.3.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rubyzip
183
183
  requirement: !ruby/object:Gem::Requirement