bolognese 0.3 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/{LICENSE → LICENSE.md} +0 -0
  4. data/README.md +81 -1
  5. data/lib/bolognese.rb +1 -0
  6. data/lib/bolognese/author_utils.rb +1 -0
  7. data/lib/bolognese/cli.rb +6 -6
  8. data/lib/bolognese/crossref.rb +23 -19
  9. data/lib/bolognese/datacite.rb +21 -17
  10. data/lib/bolognese/datacite_utils.rb +14 -5
  11. data/lib/bolognese/doi_utils.rb +2 -3
  12. data/lib/bolognese/metadata.rb +11 -5
  13. data/lib/bolognese/orcid.rb +1 -1
  14. data/lib/bolognese/schema_org.rb +157 -0
  15. data/lib/bolognese/utils.rb +31 -1
  16. data/lib/bolognese/version.rb +1 -1
  17. data/spec/crossref_spec.rb +86 -26
  18. data/spec/datacite_spec.rb +43 -2
  19. data/spec/{doi_spec.rb → doi_utils_spec.rb} +2 -2
  20. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_crossref.yml +8 -8
  21. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_datacite.yml +12 -12
  22. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/crossref/as_schema_org.yml +12 -12
  23. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/datacite/as_datacite.yml +10 -10
  24. data/spec/fixtures/vcr_cassettes/Bolognese_CLI/read/datacite/as_schema_org.yml +16 -16
  25. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/crossref.yml +931 -4
  26. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/datacite.yml +931 -4
  27. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/medra.yml +931 -4
  28. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/doi_registration_agency/not_found.yml +931 -4
  29. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_ORCID_ID.yml +506 -0
  30. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_SICI_DOI.yml +31 -94
  31. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_with_data_citation.yml +138 -14992
  32. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/date_in_future.yml +19 -2405
  33. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/journal_article.yml +107 -884
  34. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/not_found_error.yml +92 -2
  35. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/posted_content.yml +89 -5415
  36. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/DOI_with_ORCID_ID.yml +506 -0
  37. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_datacite_xml/DOI_with_data_citation.yml +137 -671
  38. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata_as_string/DOI_with_data_citation.yml +719 -0
  39. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/SICI_doi.yml +930 -0
  40. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi.yml +930 -0
  41. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_from_url_without_doi_proxy.yml +930 -0
  42. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_prefix_too_long.yml +930 -0
  43. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_prefix_with_string.yml +930 -0
  44. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/doi_with_protocol.yml +930 -0
  45. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/dx_doi_org_url.yml +930 -0
  46. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/https_url.yml +930 -0
  47. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_doi/not_valid_doi_prefix.yml +930 -0
  48. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/doi.yml +930 -0
  49. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_ids/url.yml +930 -0
  50. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_url/doi.yml +930 -0
  51. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/normalize_url/url.yml +930 -0
  52. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/array.yml +930 -0
  53. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/hash.yml +930 -0
  54. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/nil.yml +930 -0
  55. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attribute/string.yml +930 -0
  56. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/array.yml +930 -0
  57. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/hash.yml +930 -0
  58. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/nil.yml +930 -0
  59. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/parse_attributes/string.yml +930 -0
  60. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/BlogPosting.yml +248 -78
  61. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Dataset.yml +1687 -105
  62. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/Date.yml +458 -0
  63. data/spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_string/Dataset.yml +173 -0
  64. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/crossref.yml +4 -4
  65. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/crossref_doi_not_url.yml +4 -4
  66. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/datacite.yml +4 -4
  67. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/datacite_doi_http.yml +4 -4
  68. data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_PID_provider/orcid.yml +2 -2
  69. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/BlogPosting.yml +632 -0
  70. data/spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/not_found_error.yml +93 -0
  71. data/spec/metadata_spec.rb +11 -5
  72. data/spec/schema_org_spec.rb +31 -0
  73. data/spec/utils_spec.rb +87 -0
  74. metadata +35 -6
  75. data/lib/bolognese/pid_utils.rb +0 -23
  76. data/spec/fixtures/vcr_cassettes/Bolognese_Crossref/get_metadata/DOI_test.yml +0 -843
@@ -1,12 +1,32 @@
1
1
  module Bolognese
2
2
  module Utils
3
+ def normalize_orcid(orcid)
4
+ orcid = validate_orcid(orcid)
5
+ return nil unless orcid.present?
6
+
7
+ # turn ORCID ID into URL
8
+ "http://orcid.org/" + Addressable::URI.encode(orcid)
9
+ end
10
+
11
+ def orcid_from_url(url)
12
+ Array(/\Ahttp:\/\/orcid\.org\/(.+)/.match(url)).last
13
+ end
14
+
15
+ def orcid_as_url(orcid)
16
+ "http://orcid.org/#{orcid}" if orcid.present?
17
+ end
18
+
19
+ def validate_orcid(orcid)
20
+ Array(/\A(?:http:\/\/orcid\.org\/)?(\d{4}-\d{4}-\d{4}-\d{3}[0-9X]+)\z/.match(orcid)).last
21
+ end
22
+
3
23
  def parse_attributes(element)
4
24
  if element.is_a?(String)
5
25
  element
6
26
  elsif element.is_a?(Hash)
7
27
  element.fetch("text", nil)
8
28
  elsif element.is_a?(Array)
9
- element.map { |e| e.fetch("text", nil) }
29
+ element.map { |e| e.fetch("text", nil) }
10
30
  else
11
31
  nil
12
32
  end
@@ -23,5 +43,15 @@ module Bolognese
23
43
  nil
24
44
  end
25
45
  end
46
+
47
+ def normalize_url(url)
48
+ return nil unless url.present?
49
+
50
+ normalize_doi(url) || PostRank::URI.clean(url)
51
+ end
52
+
53
+ def normalize_ids(list)
54
+ Array.wrap(list).map { |url| url.merge("@id" => normalize_url(url["@id"])) }
55
+ end
26
56
  end
27
57
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.3"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -3,12 +3,31 @@ require 'spec_helper'
3
3
  describe Bolognese::Crossref, vcr: true do
4
4
  let(:id) { "10.7554/eLife.01567" }
5
5
 
6
- subject { Bolognese::Crossref.new(id) }
6
+ subject { Bolognese::Crossref.new(id: id) }
7
7
 
8
8
  context "get metadata" do
9
+ it "DOI with data citation" do
10
+ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
11
+ expect(subject.type).to eq("ScholarlyArticle")
12
+ expect(subject.additional_type).to eq("JournalArticle")
13
+ expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
14
+ {"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
15
+ {"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
16
+ {"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
17
+ {"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
18
+ expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
19
+ expect(subject.name).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
20
+ expect(subject.date_published).to eq("2014-02-11")
21
+ expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
22
+ expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
23
+ expect(subject.citation.count).to eq(27)
24
+ expect(subject.citation[21]).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.b835k", "position"=>"22", "datePublished"=>"2014")
25
+ expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
26
+ end
27
+
9
28
  it "journal article" do
10
29
  id = "https://doi.org/10.1371/journal.pone.0000030"
11
- subject = Bolognese::Crossref.new(id)
30
+ subject = Bolognese::Crossref.new(id: id)
12
31
  expect(subject.id).to eq(id)
13
32
  expect(subject.type).to eq("ScholarlyArticle")
14
33
  expect(subject.additional_type).to eq("JournalArticle")
@@ -29,7 +48,7 @@ describe Bolognese::Crossref, vcr: true do
29
48
 
30
49
  it "posted_content" do
31
50
  id = "https://doi.org/10.1101/097196"
32
- subject = Bolognese::Crossref.new(id)
51
+ subject = Bolognese::Crossref.new(id: id)
33
52
  expect(subject.id).to eq(id)
34
53
  expect(subject.type).to eq("CreativeWork")
35
54
  expect(subject.additional_type).to eq("PostedContent")
@@ -44,28 +63,9 @@ describe Bolognese::Crossref, vcr: true do
44
63
  expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
45
64
  end
46
65
 
47
- it "DOI with data citation" do
48
- expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
49
- expect(subject.type).to eq("ScholarlyArticle")
50
- expect(subject.additional_type).to eq("JournalArticle")
51
- expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
52
- {"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
53
- {"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
54
- {"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
55
- {"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
56
- expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
57
- expect(subject.name).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
58
- expect(subject.date_published).to eq("2014-02-11")
59
- expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
60
- expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
61
- expect(subject.citation.count).to eq(27)
62
- expect(subject.citation[21]).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.b835k", "position"=>"22", "datePublished"=>"2014")
63
- expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
64
- end
65
-
66
66
  it "DOI with SICI DOI" do
67
67
  id = "https://doi.org/10.1890/0012-9658(2006)87[2832:tiopma]2.0.co;2"
68
- subject = Bolognese::Crossref.new(id)
68
+ subject = Bolognese::Crossref.new(id: id)
69
69
  expect(subject.id).to eq("https://doi.org/10.1890/0012-9658(2006)87%5B2832:tiopma%5D2.0.co;2")
70
70
  expect(subject.type).to eq("ScholarlyArticle")
71
71
  expect(subject.additional_type).to eq("JournalArticle")
@@ -80,9 +80,35 @@ describe Bolognese::Crossref, vcr: true do
80
80
  expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
81
81
  end
82
82
 
83
+ it "DOI with ORCID ID" do
84
+ id = "https://doi.org/10.1155/2012/291294"
85
+ subject = Bolognese::Crossref.new(id: id)
86
+ expect(subject.id).to eq("https://doi.org/10.1155/2012/291294")
87
+ expect(subject.type).to eq("ScholarlyArticle")
88
+ expect(subject.additional_type).to eq("JournalArticle")
89
+ expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Wendy", "familyName"=>"Thanassi"},
90
+ {"@type"=>"Person", "givenName"=>"Art", "familyName"=>"Noda"},
91
+ {"@type"=>"Person",
92
+ "@id"=>"http://orcid.org/0000-0003-2043-4925",
93
+ "givenName"=>"Beatriz",
94
+ "familyName"=>"Hernandez"},
95
+ {"@type"=>"Person", "givenName"=>"Jeffery", "familyName"=>"Newell"},
96
+ {"@type"=>"Person", "givenName"=>"Paul", "familyName"=>"Terpeluk"},
97
+ {"@type"=>"Person", "givenName"=>"David", "familyName"=>"Marder"},
98
+ {"@type"=>"Person", "givenName"=>"Jerome A.", "familyName"=>"Yesavage"}])
99
+ expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
100
+ expect(subject.name).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
101
+ expect(subject.date_published).to eq("2012")
102
+ expect(subject.date_modified).to eq("2016-08-02T12:42:41Z")
103
+ expect(subject.page_start).to eq("1")
104
+ expect(subject.page_end).to eq("7")
105
+ expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"Pulmonary Medicine", "issn"=>"2090-1836")
106
+ expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
107
+ end
108
+
83
109
  it "date in future" do
84
110
  id = "https://doi.org/10.1016/j.ejphar.2015.03.018"
85
- subject = Bolognese::Crossref.new(id)
111
+ subject = Bolognese::Crossref.new(id: id)
86
112
  expect(subject.id).to eq(id)
87
113
  expect(subject.type).to eq("ScholarlyArticle")
88
114
  expect(subject.additional_type).to eq("JournalArticle")
@@ -105,17 +131,51 @@ describe Bolognese::Crossref, vcr: true do
105
131
 
106
132
  it "not found error" do
107
133
  id = "https://doi.org/10.7554/elife.01567x"
108
- subject = Bolognese::Crossref.new(id)
109
- expect(subject.id).to eq(id)
134
+ subject = Bolognese::Crossref.new(id: id)
135
+ expect(subject.id).to be_nil
110
136
  expect(subject.exists?).to be false
111
137
  end
112
138
  end
113
139
 
140
+ context "get metadata as string" do
141
+ it "DOI with data citation" do
142
+ id = "10.7554/eLife.01567"
143
+ string = Bolognese::Crossref.new(id: id).raw
144
+
145
+ subject = Bolognese::Crossref.new(string: string)
146
+ expect(subject.id).to eq("https://doi.org/10.7554/elife.01567")
147
+ expect(subject.type).to eq("ScholarlyArticle")
148
+ expect(subject.additional_type).to eq("JournalArticle")
149
+ expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Martial", "familyName"=>"Sankar"},
150
+ {"@type"=>"Person", "givenName"=>"Kaisa", "familyName"=>"Nieminen"},
151
+ {"@type"=>"Person", "givenName"=>"Laura", "familyName"=>"Ragni"},
152
+ {"@type"=>"Person", "givenName"=>"Ioannis", "familyName"=>"Xenarios"},
153
+ {"@type"=>"Person", "givenName"=>"Christian S", "familyName"=>"Hardtke"}])
154
+ expect(subject.license).to eq("http://creativecommons.org/licenses/by/3.0/")
155
+ expect(subject.name).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
156
+ expect(subject.date_published).to eq("2014-02-11")
157
+ expect(subject.date_modified).to eq("2015-08-11T05:35:02Z")
158
+ expect(subject.is_part_of).to eq("@type"=>"Periodical", "name"=>"eLife", "issn"=>"2050-084X")
159
+ expect(subject.citation.count).to eq(27)
160
+ expect(subject.citation[21]).to eq("@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.b835k", "position"=>"22", "datePublished"=>"2014")
161
+ expect(subject.provider).to eq("@type"=>"Organization", "name"=>"Crossref")
162
+ end
163
+ end
164
+
114
165
  context "get metadata as datacite xml" do
115
166
  it "DOI with data citation" do
116
167
  expect(subject.validation_errors).to be_empty
117
168
  datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
118
169
  expect(datacite.dig("titles", "title")).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
119
170
  end
171
+
172
+ it "DOI with ORCID ID" do
173
+ id = "https://doi.org/10.1155/2012/291294"
174
+ subject = Bolognese::Crossref.new(id: id)
175
+ expect(subject.validation_errors).to be_empty
176
+ datacite = Maremma.from_xml(subject.as_datacite).fetch("resource", {})
177
+ expect(datacite.dig("creators", "creator").count).to eq(7)
178
+ expect(datacite.dig("creators", "creator").first).to eq("creatorName"=>"Thanassi, Wendy", "givenName"=>"Wendy", "familyName"=>"Thanassi")
179
+ end
120
180
  end
121
181
  end
@@ -4,7 +4,7 @@ describe Bolognese::Datacite, vcr: true do
4
4
  context "get metadata" do
5
5
  let(:id) { "https://doi.org/10.5061/DRYAD.8515" }
6
6
 
7
- subject { Bolognese::Datacite.new(id) }
7
+ subject { Bolognese::Datacite.new(id: id) }
8
8
 
9
9
  it "Dataset" do
10
10
  expect(subject.id).to eq("https://doi.org/10.5061/dryad.8515")
@@ -30,7 +30,7 @@ describe Bolognese::Datacite, vcr: true do
30
30
 
31
31
  it "BlogPosting" do
32
32
  id = "https://doi.org/10.5438/4K3M-NYVG"
33
- subject = Bolognese::Datacite.new(id)
33
+ subject = Bolognese::Datacite.new(id: id)
34
34
  expect(subject.id).to eq("https://doi.org/10.5438/4k3m-nyvg")
35
35
  expect(subject.type).to eq("ScholarlyArticle")
36
36
  expect(subject.additional_type).to eq("BlogPosting")
@@ -45,5 +45,46 @@ describe Bolognese::Datacite, vcr: true do
45
45
  {"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5438/55e5-t5c0"}])
46
46
  expect(subject.provider).to eq("@type"=>"Organization", "name"=>"DataCite")
47
47
  end
48
+
49
+ it "Date" do
50
+ id = "https://doi.org/10.4230/lipics.tqc.2013.93"
51
+ subject = Bolognese::Datacite.new(id: id)
52
+ expect(subject.id).to eq("https://doi.org/10.4230/lipics.tqc.2013.93")
53
+ expect(subject.type).to eq("ScholarlyArticle")
54
+ expect(subject.additional_type).to eq("ConferencePaper")
55
+ expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Nathaniel", "familyName"=>"Johnston"}])
56
+ expect(subject.name).to eq("The Minimum Size of Qubit Unextendible Product Bases")
57
+ expect(subject.description).to start_with("We investigate the problem of constructing unextendible product bases in the qubit case")
58
+ expect(subject.date_published).to eq("2013")
59
+ expect(subject.provider).to eq("@type"=>"Organization", "name"=>"DataCite")
60
+ end
61
+ end
62
+
63
+ context "get metadata as string" do
64
+ it "Dataset" do
65
+ id = "https://doi.org/10.5061/DRYAD.8515"
66
+ string = Bolognese::Datacite.new(id: id).raw
67
+
68
+ subject = Bolognese::Datacite.new(string: string)
69
+ expect(subject.id).to eq("https://doi.org/10.5061/dryad.8515")
70
+ expect(subject.type).to eq("Dataset")
71
+ expect(subject.additional_type).to eq("DataPackage")
72
+ expect(subject.author).to eq([{"@type"=>"Person", "givenName"=>"Benjamin", "familyName"=>"Ollomo"},
73
+ {"@type"=>"Person", "givenName"=>"Patrick", "familyName"=>"Durand"},
74
+ {"@type"=>"Person", "givenName"=>"Franck", "familyName"=>"Prugnolle"},
75
+ {"@type"=>"Person", "givenName"=>"Emmanuel J. P.", "familyName"=>"Douzery"},
76
+ {"@type"=>"Person", "givenName"=>"Céline", "familyName"=>"Arnathau"},
77
+ {"@type"=>"Person", "givenName"=>"Dieudonné", "familyName"=>"Nkoghe"},
78
+ {"@type"=>"Person", "givenName"=>"Eric", "familyName"=>"Leroy"},
79
+ {"@type"=>"Person", "givenName"=>"François", "familyName"=>"Renaud"}])
80
+ expect(subject.name).to eq("Data from: A new malaria agent in African hominids.")
81
+ expect(subject.alternate_name).to eq("Ollomo B, Durand P, Prugnolle F, Douzery EJP, Arnathau C, Nkoghe D, Leroy E, Renaud F (2009) A new malaria agent in African hominids. PLoS Pathogens 5(5): e1000446.")
82
+ expect(subject.license).to eq("http://creativecommons.org/publicdomain/zero/1.0/")
83
+ expect(subject.date_published).to eq("2011")
84
+ expect(subject.has_part).to eq([{"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.8515/1"},
85
+ {"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.5061/dryad.8515/2"}])
86
+ expect(subject.citation).to eq([{"@type"=>"CreativeWork", "@id"=>"https://doi.org/10.1371/journal.ppat.1000446"}])
87
+ expect(subject.provider).to eq("@type"=>"Organization", "name"=>"DataCite")
88
+ end
48
89
  end
49
90
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Bolognese::Crossref, vcr: true do
4
4
  let(:id) { "https://doi.org/10.1371/journal.pone.0000030" }
5
5
 
6
- subject { Bolognese::Crossref.new(id) }
6
+ subject { Bolognese::Crossref.new(id: id) }
7
7
 
8
8
  context "normalize doi" do
9
9
  it "doi" do
@@ -83,7 +83,7 @@ describe Bolognese::Crossref, vcr: true do
83
83
  it "not found" do
84
84
  doi = "https://doi.org/10.5061/dryad.8515x"
85
85
  response = subject.get_doi_ra(doi)
86
- expect(response["errors"]).to eq([{"DOI"=>"10.5061/DRYAD.8515X", "status"=>"Invalid DOI"}])
86
+ expect(response["errors"]).to eq([{"DOI"=>"10.5061/dryad.8515x", "status"=>"Invalid DOI"}])
87
87
  end
88
88
  end
89
89
  end
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://doi.crossref.org/doiRA/10.7554/ELIFE.01567
5
+ uri: https://doi.crossref.org/doiRA/10.7554/elife.01567
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -27,7 +27,7 @@ http_interactions:
27
27
  Content-Length:
28
28
  - '57'
29
29
  Date:
30
- - Fri, 17 Feb 2017 07:46:57 GMT
30
+ - Fri, 17 Feb 2017 08:06:57 GMT
31
31
  Connection:
32
32
  - close
33
33
  body:
@@ -35,12 +35,12 @@ http_interactions:
35
35
  string: |-
36
36
  [
37
37
  {
38
- "DOI": "10.7554/ELIFE.01567",
38
+ "DOI": "10.7554/elife.01567",
39
39
  "RA": "Crossref"
40
40
  }
41
41
  ]
42
42
  http_version:
43
- recorded_at: Fri, 17 Feb 2017 07:47:00 GMT
43
+ recorded_at: Fri, 17 Feb 2017 08:06:58 GMT
44
44
  - request:
45
45
  method: get
46
46
  uri: https://doi.org/10.7554/elife.01567
@@ -70,14 +70,14 @@ http_interactions:
70
70
  Content-Length:
71
71
  - '177'
72
72
  Date:
73
- - Fri, 17 Feb 2017 07:47:07 GMT
73
+ - Fri, 17 Feb 2017 08:06:58 GMT
74
74
  body:
75
75
  encoding: UTF-8
76
76
  string: |-
77
77
  <html><head><title>Handle Redirect</title></head>
78
78
  <body><a href="http://data.crossref.org/10.7554%2Felife.01567">http://data.crossref.org/10.7554%2Felife.01567</a></body></html>
79
79
  http_version:
80
- recorded_at: Fri, 17 Feb 2017 07:47:08 GMT
80
+ recorded_at: Fri, 17 Feb 2017 08:06:58 GMT
81
81
  - request:
82
82
  method: get
83
83
  uri: http://data.crossref.org/10.7554%2Felife.01567
@@ -113,7 +113,7 @@ http_interactions:
113
113
  Server:
114
114
  - http-kit
115
115
  Date:
116
- - Fri, 17 Feb 2017 07:47:07 GMT
116
+ - Fri, 17 Feb 2017 08:06:58 GMT
117
117
  Connection:
118
118
  - close
119
119
  body:
@@ -756,5 +756,5 @@ http_interactions:
756
756
  aWNsZT4NCiAgICAgIDwvam91cm5hbD4NCiAgICA8L2Nyb3NzcmVmPg0KICA8
757
757
  L2RvaV9yZWNvcmQ+DQo8L2RvaV9yZWNvcmRzPg==
758
758
  http_version:
759
- recorded_at: Fri, 17 Feb 2017 07:47:09 GMT
759
+ recorded_at: Fri, 17 Feb 2017 08:06:58 GMT
760
760
  recorded_with: VCR 3.0.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://doi.crossref.org/doiRA/10.7554/ELIFE.01567
5
+ uri: https://doi.crossref.org/doiRA/10.7554/elife.01567
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -27,7 +27,7 @@ http_interactions:
27
27
  Content-Length:
28
28
  - '57'
29
29
  Date:
30
- - Fri, 17 Feb 2017 07:47:08 GMT
30
+ - Fri, 17 Feb 2017 08:06:54 GMT
31
31
  Connection:
32
32
  - close
33
33
  body:
@@ -35,12 +35,12 @@ http_interactions:
35
35
  string: |-
36
36
  [
37
37
  {
38
- "DOI": "10.7554/ELIFE.01567",
38
+ "DOI": "10.7554/elife.01567",
39
39
  "RA": "Crossref"
40
40
  }
41
41
  ]
42
42
  http_version:
43
- recorded_at: Fri, 17 Feb 2017 07:47:09 GMT
43
+ recorded_at: Fri, 17 Feb 2017 08:06:54 GMT
44
44
  - request:
45
45
  method: get
46
46
  uri: https://doi.org/10.7554/elife.01567
@@ -70,14 +70,14 @@ http_interactions:
70
70
  Content-Length:
71
71
  - '177'
72
72
  Date:
73
- - Fri, 17 Feb 2017 07:47:16 GMT
73
+ - Fri, 17 Feb 2017 08:06:53 GMT
74
74
  body:
75
75
  encoding: UTF-8
76
76
  string: |-
77
77
  <html><head><title>Handle Redirect</title></head>
78
78
  <body><a href="http://data.crossref.org/10.7554%2Felife.01567">http://data.crossref.org/10.7554%2Felife.01567</a></body></html>
79
79
  http_version:
80
- recorded_at: Fri, 17 Feb 2017 07:47:18 GMT
80
+ recorded_at: Fri, 17 Feb 2017 08:06:54 GMT
81
81
  - request:
82
82
  method: get
83
83
  uri: http://data.crossref.org/10.7554%2Felife.01567
@@ -113,7 +113,7 @@ http_interactions:
113
113
  Server:
114
114
  - http-kit
115
115
  Date:
116
- - Fri, 17 Feb 2017 07:47:17 GMT
116
+ - Fri, 17 Feb 2017 08:06:54 GMT
117
117
  Connection:
118
118
  - close
119
119
  body:
@@ -756,7 +756,7 @@ http_interactions:
756
756
  aWNsZT4NCiAgICAgIDwvam91cm5hbD4NCiAgICA8L2Nyb3NzcmVmPg0KICA8
757
757
  L2RvaV9yZWNvcmQ+DQo8L2RvaV9yZWNvcmRzPg==
758
758
  http_version:
759
- recorded_at: Fri, 17 Feb 2017 07:47:18 GMT
759
+ recorded_at: Fri, 17 Feb 2017 08:06:55 GMT
760
760
  - request:
761
761
  method: get
762
762
  uri: https://doi.org/10.7554/elife.01567
@@ -786,14 +786,14 @@ http_interactions:
786
786
  Content-Length:
787
787
  - '177'
788
788
  Date:
789
- - Fri, 17 Feb 2017 07:47:25 GMT
789
+ - Fri, 17 Feb 2017 08:06:54 GMT
790
790
  body:
791
791
  encoding: UTF-8
792
792
  string: |-
793
793
  <html><head><title>Handle Redirect</title></head>
794
794
  <body><a href="http://data.crossref.org/10.7554%2Felife.01567">http://data.crossref.org/10.7554%2Felife.01567</a></body></html>
795
795
  http_version:
796
- recorded_at: Fri, 17 Feb 2017 07:47:26 GMT
796
+ recorded_at: Fri, 17 Feb 2017 08:06:55 GMT
797
797
  - request:
798
798
  method: get
799
799
  uri: http://data.crossref.org/10.7554%2Felife.01567
@@ -829,7 +829,7 @@ http_interactions:
829
829
  Server:
830
830
  - http-kit
831
831
  Date:
832
- - Fri, 17 Feb 2017 07:47:26 GMT
832
+ - Fri, 17 Feb 2017 08:06:55 GMT
833
833
  Connection:
834
834
  - close
835
835
  body:
@@ -1472,5 +1472,5 @@ http_interactions:
1472
1472
  aWNsZT4NCiAgICAgIDwvam91cm5hbD4NCiAgICA8L2Nyb3NzcmVmPg0KICA8
1473
1473
  L2RvaV9yZWNvcmQ+DQo8L2RvaV9yZWNvcmRzPg==
1474
1474
  http_version:
1475
- recorded_at: Fri, 17 Feb 2017 07:47:27 GMT
1475
+ recorded_at: Fri, 17 Feb 2017 08:06:55 GMT
1476
1476
  recorded_with: VCR 3.0.3