bolognese 1.1.6 → 1.1.7

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: 02ec698005af34046845045a8a78bd47ed1b70579678768b6117e242194c641e
4
- data.tar.gz: ad2fbbd3bac845ce7c10f9c07f2a439b258a90cfe7020633adaa69568c92531d
3
+ metadata.gz: 71f4d74385d924fbaabb7f004be5d932cc1b3ada31b9004ed23e96971d7aa9bd
4
+ data.tar.gz: 9ed032df2411626a7a492985696b2516fc1ac1f066cfa73c2d5cf081ac6573bb
5
5
  SHA512:
6
- metadata.gz: 50ca5d8a322de56b3d416c52e18080a6024e2d8ef706a268a8488d03f25ab6ec9f616943d6c6db4e6779459aa1d1191841613064a8d1b8892746554d5444cc42
7
- data.tar.gz: 2c12554875e95489534c0a7fda479985f3b75e3fd5b24358f6bf63576e4a19f483bf9a3ea21dde316be5c808a3177f1c65734f6287d856deeb4c0a159e16c173
6
+ metadata.gz: 2ea430692c764eae6076a3124269d312c7c13f6b92123b5575edb65fd7f7ff319c9ce828307615578adf6a0fc0bad1a02d1b1fdb11b14783cdfc64c339a5aa52
7
+ data.tar.gz: 02e289d34a7ad6de259ff96ef5241fab11090b3b2bab3253aad2b658c6e4b1c1b7ee42f35839e0ca482a4bda3e2c635b9f0ac72e21d7a5c06d6b0707fa3cd596
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.1.6)
4
+ bolognese (1.1.7)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -78,10 +78,10 @@ GEM
78
78
  concurrent-ruby (~> 1.0)
79
79
  hashdiff (0.3.8)
80
80
  htmlentities (4.3.4)
81
- i18n (1.5.3)
81
+ i18n (1.6.0)
82
82
  concurrent-ruby (~> 1.0)
83
83
  iso8601 (0.9.1)
84
- json (2.1.0)
84
+ json (2.2.0)
85
85
  json-ld (2.2.1)
86
86
  multi_json (~> 1.12)
87
87
  rdf (>= 2.2.8, < 4.0)
@@ -158,15 +158,15 @@ GEM
158
158
  rspec-xsd (0.1.0)
159
159
  nokogiri (~> 1.6)
160
160
  rspec (~> 3)
161
- safe_yaml (1.0.4)
161
+ safe_yaml (1.0.5)
162
162
  simplecov (0.13.0)
163
163
  docile (~> 1.1.0)
164
164
  json (>= 1.8, < 3)
165
165
  simplecov-html (~> 0.10.0)
166
166
  simplecov-html (0.10.2)
167
- sxp (1.0.1)
168
- rdf (>= 2.2, < 4.0)
169
- temple (0.8.0)
167
+ sxp (1.0.2)
168
+ rdf (~> 3.0)
169
+ temple (0.8.1)
170
170
  thor (0.20.3)
171
171
  thread_safe (0.3.6)
172
172
  tilt (2.0.9)
@@ -68,13 +68,13 @@ module Bolognese
68
68
  def insert_person(xml, person, type)
69
69
  person_name = person["familyName"].present? ? [person["familyName"], person["givenName"]].compact.join(", ") : person["name"]
70
70
  attributes = { "nameType" => person["nameType"] }.compact
71
-
72
71
  xml.send(type + "Name", person_name, attributes)
73
72
  xml.givenName(person["givenName"]) if person["givenName"].present?
74
73
  xml.familyName(person["familyName"]) if person["familyName"].present?
75
74
  Array.wrap(person["nameIdentifiers"]).each do |ni|
76
75
  xml.nameIdentifier(ni["nameIdentifier"], 'nameIdentifierScheme' => ni["nameIdentifierScheme"])
77
76
  end
77
+ xml.affiliation(person["affiliation"]) if person["affiliation"].present?
78
78
  end
79
79
 
80
80
  def insert_titles(xml)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.1.6"
2
+ VERSION = "1.1.7"
3
3
  end
@@ -47,7 +47,7 @@ describe Bolognese::Metadata, vcr: true do
47
47
  subject = Bolognese::Metadata.new(input: input, from: "schema_org")
48
48
  expect(subject.valid?).to be false
49
49
  expect(subject.errors.size).to eq(2)
50
- expect(subject.errors.first).to eq("43:0: ERROR: Element '{http://datacite.org/schema/kernel-4}publisher': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.")
50
+ expect(subject.errors.first).to eq("49:0: ERROR: Element '{http://datacite.org/schema/kernel-4}publisher': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'.")
51
51
  expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5281/zenodo.1196821", "identifierType"=>"DOI"}])
52
52
  expect(subject.doi).to eq("10.5281/zenodo.1196821")
53
53
  expect(subject.url).to eq("https://zenodo.org/record/1196821")
@@ -71,13 +71,13 @@ describe Bolognese::Metadata, vcr: true do
71
71
  expect(subject.valid?).to be true
72
72
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
73
73
  expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API")
74
- expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>{"__content__"=>"Jones, Matt", "nameType"=>"Personal"},
74
+ expect(datacite.dig("creators", "creator")).to eq([{"affiliation"=>"NCEAS", "creatorName"=>{"__content__"=>"Jones, Matt", "nameType"=>"Personal"},
75
75
  "givenName"=>"Matt",
76
76
  "familyName"=>"Jones",
77
77
  "nameIdentifier"=>
78
78
  {"nameIdentifierScheme"=>"ORCID",
79
79
  "__content__"=>"https://orcid.org/0000-0003-0077-4738"}},
80
- {"creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
80
+ {"affiliation"=>"NCEAS", "creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
81
81
  "givenName"=>"Peter",
82
82
  "familyName"=>"Slaughter",
83
83
  "nameIdentifier"=>
@@ -93,13 +93,13 @@ describe Bolognese::Metadata, vcr: true do
93
93
  expect(subject.valid?).to be true
94
94
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
95
95
  expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API")
96
- expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>{"__content__"=>"Jones, Matt", "nameType"=>"Personal"},
96
+ expect(datacite.dig("creators", "creator")).to eq([{"affiliation"=>"NCEAS", "creatorName"=>{"__content__"=>"Jones, Matt", "nameType"=>"Personal"},
97
97
  "givenName"=>"Matt",
98
98
  "familyName"=>"Jones",
99
99
  "nameIdentifier"=>
100
100
  {"nameIdentifierScheme"=>"ORCID",
101
101
  "__content__"=>"https://orcid.org/0000-0003-0077-4738"}},
102
- {"creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
102
+ {"affiliation"=>"NCEAS", "creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
103
103
  "givenName"=>"Peter",
104
104
  "familyName"=>"Slaughter",
105
105
  "nameIdentifier"=>
@@ -115,7 +115,7 @@ describe Bolognese::Metadata, vcr: true do
115
115
  expect(subject.valid?).to be true
116
116
  datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
117
117
  expect(datacite.dig("titles", "title")).to eq("Maremma: a Ruby library for simplified network calls")
118
- expect(datacite.dig("creators", "creator")).to eq("creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"__content__"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"})
118
+ expect(datacite.dig("creators", "creator")).to eq("affiliation"=>"DataCite", "creatorName"=> {"__content__"=>"Fenner, Martin", "nameType"=>"Personal"}, "givenName"=>"Martin", "familyName"=>"Fenner", "nameIdentifier"=>{"__content__"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"})
119
119
  end
120
120
 
121
121
  it "Text pass-thru" do
@@ -179,6 +179,28 @@ describe Bolognese::Metadata, vcr: true do
179
179
  expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
180
180
  end
181
181
 
182
+ it "Affiliation" do
183
+ input = fixture_path + 'datacite-example-geolocation-2.xml'
184
+ doi = "10.6071/Z7WC73"
185
+ subject = Bolognese::Metadata.new(input: input, from: "datacite", regenerate: true)
186
+ expect(subject.valid?).to be true
187
+ expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"dataset", "resourceType"=>"dataset", "resourceTypeGeneral"=>"Dataset", "ris"=>"DATA", "schemaOrg"=>"Dataset")
188
+ expect(subject.creators.length).to eq(6)
189
+ expect(subject.creators.first).to eq("affiliation"=>"UC Merced", "familyName"=>"Bales", "givenName"=>"Roger", "name"=>"Bales, Roger", "nameType"=>"Personal")
190
+ expect(subject.titles).to eq([{"title"=>"Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek\n meteorological data, soil moisture and temperature, snow depth and air\n temperature"}])
191
+ expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.6071/z7wc73", "identifierType"=>"DOI"}])
192
+ expect(subject.rights_list).to eq([{"rights"=>"Creative Commons Attribution 4.0 International (CC BY 4.0)", "rightsUri"=>"https://creativecommons.org/licenses/by/4.0"}])
193
+ expect(subject.dates).to eq([{"date"=>"2014-10-17", "dateType"=>"Updated"}, {"date"=>"2016-03-14T17:02:02Z", "dateType"=>"Available"}, {"date"=>"2013", "dateType"=>"Issued"}])
194
+ expect(subject.publication_year).to eq("2013")
195
+ expect(subject.publisher).to eq("UC Merced")
196
+ expect(subject.agency).to eq("DataCite")
197
+ expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
198
+
199
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
200
+ expect(datacite.fetch("xsi:schemaLocation", "").split(" ").first).to eq("http://datacite.org/schema/kernel-4")
201
+ expect(datacite.dig("creators", "creator", 0, "affiliation")).to eq("UC Merced")
202
+ end
203
+
182
204
  it "with data citation schema.org" do
183
205
  input = "https://blog.datacite.org/eating-your-own-dog-food/"
184
206
  subject = Bolognese::Metadata.new(input: input, from: "schema_org")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-20 00:00:00.000000000 Z
11
+ date: 2019-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -1074,7 +1074,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1074
1074
  - !ruby/object:Gem::Version
1075
1075
  version: '0'
1076
1076
  requirements: []
1077
- rubygems_version: 3.0.2
1077
+ rubygems_version: 3.0.3
1078
1078
  signing_key:
1079
1079
  specification_version: 4
1080
1080
  summary: Ruby client library for conversion of DOI Metadata