bolognese 1.1 → 1.1.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: c62a598e109f6caf9fe34a1b9237eb1360f6cc3992a25c46cf56afe36d6bc7c9
4
- data.tar.gz: f96ed6464ded442d7d87f1eb6e660b9c22435f89c78bfa7690e4573f53f2a409
3
+ metadata.gz: 3ff0be2c3f93e115b37c7fb40e472979f997660034fe611caa145f94eda6f00d
4
+ data.tar.gz: ec082c7b6ddd9f0f8abf2f5c08897b3ca73a48ad9a391a3e4de570a9556bf2ee
5
5
  SHA512:
6
- metadata.gz: 39cc52b608b54aea3cf0e6716b718d7523a7648c28cb20ae04875286e25103f3cc0961a7f32ab4a9668fa79769b164aff5fb02b5c68af230003df5582d0bae20
7
- data.tar.gz: e3279dc77b34a8978eda30de20f9ef9348833b866fe8241b36d8233e64c4f19bc8011047a7deb2388548067cdf0c0f9b0f96ffa8d9b4fde9060a3c0fb7ac5ea4
6
+ metadata.gz: 23f5743255d698fa71e7297e67335883abe7fd093c7a38b1a25ffe1d26d6462e36034f591cc00fdf3baafd649426393e8d3e25938744da2de91b102c155d37aa
7
+ data.tar.gz: ad05fdb0f221944bb4a2dbc0b06fb69e14244b819762585bb293acf06697dba0815bee2eea5c7a77b4606b4ffbdc8e7b8f692f248117f6afedc933779462e4df
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.1)
4
+ bolognese (1.1.1)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -13,7 +13,7 @@ module Bolognese
13
13
  :subjects, :contributor, :descriptions, :language, :sizes,
14
14
  :formats, :schema_version, :meta, :container, :agency,
15
15
  :format, :funding_references, :state, :geo_locations,
16
- :types, :content_url, :related_identifiers, :style, :locale
16
+ :types, :content_url, :related_identifiers, :style, :locale, :date_registered
17
17
 
18
18
  def initialize(input: nil, from: nil, **options)
19
19
  id = normalize_id(input, options)
@@ -215,6 +215,10 @@ module Bolognese
215
215
  @state ||= meta.fetch("state", nil)
216
216
  end
217
217
 
218
+ def date_registered
219
+ @date_registered ||= meta.fetch("date_registered", nil)
220
+ end
221
+
218
222
  def types
219
223
  @types ||= meta.fetch("types", nil)
220
224
  end
@@ -833,6 +833,12 @@ module Bolognese
833
833
  { 'date-parts' => [[year.to_i, month.to_i, day.to_i].reject { |part| part == 0 }] }
834
834
  end
835
835
 
836
+ def get_iso8601_date(iso8601_time)
837
+ return nil if iso8601_time.nil?
838
+
839
+ iso8601_time[0..9]
840
+ end
841
+
836
842
  def get_year_month(iso8601_time)
837
843
  return [] if iso8601_time.nil?
838
844
 
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.1"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -2,7 +2,7 @@ module Bolognese
2
2
  module Writers
3
3
  module CsvWriter
4
4
  require "csv"
5
-
5
+
6
6
  def csv
7
7
  return nil unless valid?
8
8
 
@@ -12,6 +12,9 @@ module Bolognese
12
12
  doi: doi,
13
13
  url: url,
14
14
  year: publication_year,
15
+ registered: get_iso8601_date(date_registered),
16
+ state: state,
17
+ resource_type_general: types["resourceTypeGeneral"],
15
18
  bibtex_type: types["bibtex"].presence || "misc",
16
19
  title: parse_attributes(titles, content: "title", first: true),
17
20
  author: authors_as_string(creators),
@@ -19,9 +22,7 @@ module Bolognese
19
22
  journal: container && container["title"],
20
23
  volume: container.to_h["volume"],
21
24
  issue: container.to_h["issue"],
22
- pages: pages,
23
- language: language,
24
- keywords: subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) }.join(", ") : nil
25
+ pages: pages
25
26
  }.values
26
27
 
27
28
  CSV.generate { |csv| csv << bib }
@@ -12,11 +12,14 @@ describe Bolognese::Metadata, vcr: true do
12
12
  expect(csv[0]).to eq("10.7554/elife.01567")
13
13
  expect(csv[1]).to eq("https://elifesciences.org/articles/01567")
14
14
  expect(csv[2]).to eq("2014")
15
- expect(csv[3]).to eq("article")
16
- expect(csv[4]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
17
- expect(csv[5]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
18
- expect(csv[6]).to eq("(:unav)")
19
- expect(csv[7]).to eq("eLife")
15
+ expect(csv[3]).to be_nil
16
+ expect(csv[4]).to eq("findable")
17
+ expect(csv[5]).to eq("Text")
18
+ expect(csv[6]).to eq("article")
19
+ expect(csv[7]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
20
+ expect(csv[8]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
21
+ expect(csv[9]).to eq("(:unav)")
22
+ expect(csv[10]).to eq("eLife")
20
23
  end
21
24
 
22
25
  it "with pages" do
@@ -27,12 +30,17 @@ describe Bolognese::Metadata, vcr: true do
27
30
  expect(csv[0]).to eq("10.1155/2012/291294")
28
31
  expect(csv[1]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
29
32
  expect(csv[2]).to eq("2012")
30
- expect(csv[3]).to eq("article")
31
- expect(csv[4]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
32
- expect(csv[5]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
33
- expect(csv[6]).to eq("(:unav)")
34
- expect(csv[7]).to eq("Pulmonary Medicine")
35
- expect(csv[10]).to eq("1-7")
33
+ expect(csv[3]).to be_nil
34
+ expect(csv[4]).to eq("findable")
35
+ expect(csv[5]).to eq("Text")
36
+ expect(csv[6]).to eq("article")
37
+ expect(csv[7]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
38
+ expect(csv[8]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
39
+ expect(csv[9]).to eq("(:unav)")
40
+ expect(csv[10]).to eq("Pulmonary Medicine")
41
+ expect(csv[11]).to eq("2012")
42
+ expect(csv[12]).to be_nil
43
+ expect(csv[13]).to eq("1-7")
36
44
  end
37
45
 
38
46
  it "text" do
@@ -44,10 +52,14 @@ describe Bolognese::Metadata, vcr: true do
44
52
  expect(csv[0]).to eq("10.17173/pretest8")
45
53
  expect(csv[1]).to eq("http://pretest.gesis.org/Pretest/DoiId/10.17173/pretest8")
46
54
  expect(csv[2]).to eq("2014")
47
- expect(csv[3]).to eq("article")
48
- expect(csv[4]).to eq("PIAAC-Longitudinal (PIAAC-L) 2015")
49
- expect(csv[5]).to eq("Lenzner, T. and Neuert, C. and Otto, W. and Landrock, U. and Menold, N.")
50
- expect(csv[6]).to eq("GESIS – Pretest Lab")
55
+ expect(csv[3]).to eq("2016-06-01")
56
+ expect(csv[4]).to eq("findable")
57
+ expect(csv[5]).to eq("Text")
58
+ expect(csv[6]).to eq("article")
59
+ expect(csv[7]).to eq("PIAAC-Longitudinal (PIAAC-L) 2015")
60
+ expect(csv[8]).to eq("Lenzner, T. and Neuert, C. and Otto, W. and Landrock, U. and Menold, N.")
61
+ expect(csv[9]).to eq("GESIS – Pretest Lab")
62
+ expect(csv[10]).to eq("GESIS Projektbericht")
51
63
  end
52
64
 
53
65
  it "climate data" do
@@ -59,10 +71,13 @@ describe Bolognese::Metadata, vcr: true do
59
71
  expect(csv[0]).to eq("10.5067/altcy-tj122")
60
72
  expect(csv[1]).to eq("http://podaac.jpl.nasa.gov/dataset/MERGED_TP_J1_OSTM_OST_CYCLES_V2")
61
73
  expect(csv[2]).to eq("2012")
62
- expect(csv[3]).to eq("misc")
63
- expect(csv[4]).to eq("Integrated Multi-Mission Ocean Altimeter Data for Climate Research Version 2")
64
- expect(csv[5]).to eq("{GSFC}")
65
- expect(csv[6]).to eq("NASA Physical Oceanography DAAC")
74
+ expect(csv[3]).to eq("2014-01-15")
75
+ expect(csv[4]).to eq("findable")
76
+ expect(csv[5]).to eq("Dataset")
77
+ expect(csv[6]).to eq("misc")
78
+ expect(csv[7]).to eq("Integrated Multi-Mission Ocean Altimeter Data for Climate Research Version 2")
79
+ expect(csv[8]).to eq("{GSFC}")
80
+ expect(csv[9]).to eq("NASA Physical Oceanography DAAC")
66
81
  end
67
82
 
68
83
  it "maremma" do
@@ -73,11 +88,13 @@ describe Bolognese::Metadata, vcr: true do
73
88
  expect(csv[0]).to eq("10.5438/qeg0-3gm3")
74
89
  expect(csv[1]).to eq("https://github.com/datacite/maremma")
75
90
  expect(csv[2]).to eq("2017")
76
- expect(csv[3]).to eq("misc")
77
- expect(csv[4]).to eq("Maremma: a Ruby library for simplified network calls")
78
- expect(csv[5]).to eq("Fenner, Martin")
79
- expect(csv[6]).to eq("DataCite")
80
- expect(csv[12]).to eq("faraday, excon, net/http")
91
+ expect(csv[3]).to be_nil
92
+ expect(csv[4]).to eq("findable")
93
+ expect(csv[5]).to eq("Software")
94
+ expect(csv[6]).to eq("misc")
95
+ expect(csv[7]).to eq("Maremma: a Ruby library for simplified network calls")
96
+ expect(csv[8]).to eq("Fenner, Martin")
97
+ expect(csv[9]).to eq("DataCite")
81
98
  end
82
99
  end
83
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner