bolognese 0.9.15 → 0.9.16

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: cd64adf0b946033b548a03ccde85d5d9c554bd01
4
- data.tar.gz: 442baadbc2f9f39f3c8d8bef4fc0d985f6388fd7
3
+ metadata.gz: 8e3b5dfcc9f59a35dc3787205cbc5d3acb1234fa
4
+ data.tar.gz: 8a5bd7038d69a484899b7c7a564dc2e51d647a2f
5
5
  SHA512:
6
- metadata.gz: d993bd5e533833f8405ab4b76611d84c06ea4d700783ce65bca967148a7dd7fb3b69dae3b5c562e7603c89f0e0834d991c5cdbaa3c402e521daba7c58b00d07b
7
- data.tar.gz: 69c755064916c60c16afc187c55bf29c2b24128ee8074e9439bc6ddc31d276dce50b9763a0f22716b4a5a104c4106adb73eb39273120429b75c083cfd23cd65f
6
+ metadata.gz: 12dbc8e38c850794aad9426e19df9bb34bb8856988080db7b63e437b245f3e154ca8c03beddef970fcb0600bf84d0b865b19e6b7121d9c86f0ab917eea5b5a41
7
+ data.tar.gz: 2b3681684f694194e60db100450d1d8df1e56149c7ca35460318761d284fa23616cdf3bd7fc44d1bbdb059bd24ee32f17dec75c486f93c3efcbfab93b0771120
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.15)
4
+ bolognese (0.9.16)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -61,7 +61,7 @@ module Bolognese
61
61
  author = author.gsub(" - ", "-")
62
62
 
63
63
  # remove text in parentheses
64
- author = author.sub(/\s*\(.+\)$/, '')
64
+ author = author.sub(/\s*\(.+\)\s*/, '')
65
65
 
66
66
  # titleize strings
67
67
  # remove non-standard space characters
@@ -57,7 +57,7 @@ module Bolognese
57
57
  "date_published" => meta.date.to_s.presence,
58
58
  "volume" => meta.volume.to_s.presence,
59
59
  "pagination" => meta.pages.to_s.presence,
60
- "description" => { "text" => meta.field?(:abstract) && meta.abstract.to_s.presence },
60
+ "description" => { "text" => meta.field?(:abstract) && sanitize(meta.abstract.to_s).presence },
61
61
  "license" => { "id" => meta.field?(:copyright) && meta.copyright.to_s.presence }
62
62
  }
63
63
  end
@@ -61,7 +61,7 @@ module Bolognese
61
61
  "date_published" => date_published,
62
62
  "volume" => meta.fetch("volume", nil),
63
63
  #{}"pagination" => meta.pages.to_s.presence,
64
- "description" => { "text" => meta.fetch("abstract", nil) },
64
+ "description" => meta.fetch("abstract", nil).present? ? { "text" => sanitize(meta.fetch("abstract")) } : nil,
65
65
  #{ }"license" => { "id" => meta.field?(:copyright) && meta.copyright.to_s.presence },
66
66
  "version" => meta.fetch("version", nil),
67
67
  "keywords" => meta.fetch("categories", nil)
@@ -40,7 +40,7 @@ module Bolognese
40
40
  "date_created" => meta.fetch("dateCreated", nil),
41
41
  "date_published" => date_published,
42
42
  "date_modified" => meta.fetch("dateModified", nil),
43
- "description" => { "text" => meta.fetch("description", nil) },
43
+ "description" => meta.fetch("description", nil).present? ? { "text" => sanitize(meta.fetch("description")) } : nil,
44
44
  "license" => { "id" => meta.fetch("license", nil) },
45
45
  "version" => meta.fetch("version", nil),
46
46
  "keywords" => Array.wrap(meta.fetch("tags", nil)).join(", ").presence
@@ -144,7 +144,7 @@ module Bolognese
144
144
  if des.is_a?(Hash)
145
145
  des.to_xml
146
146
  elsif des.is_a?(String)
147
- des
147
+ sanitize(des)
148
148
  end
149
149
  end
150
150
 
@@ -62,7 +62,7 @@ module Bolognese
62
62
  "date_created" => meta.fetch("Y1", nil),
63
63
  "date_published" => meta.fetch("PY", nil),
64
64
  "date_accessed" => meta.fetch("Y2", nil),
65
- "description" => meta.fetch("AB", nil).present? ? { "text" => meta.fetch("AB", nil) } : nil,
65
+ "description" => meta.fetch("AB", nil).present? ? { "text" => sanitize(meta.fetch("AB")) } : nil,
66
66
  "volume" => meta.fetch("VL", nil),
67
67
  "issue" => meta.fetch("IS", nil),
68
68
  "pagination" => [meta.fetch("SP", nil), meta.fetch("EP", nil)].compact.join("-").presence,
@@ -52,7 +52,7 @@ module Bolognese
52
52
  "date_created" => meta.fetch("dateCreated", nil),
53
53
  "date_published" => date_published,
54
54
  "date_modified" => meta.fetch("dateModified", nil),
55
- "description" => { "text" => meta.fetch("description", nil) },
55
+ "description" => meta.fetch("description", nil).present? ? { "text" => sanitize(meta.fetch("description")) } : nil,
56
56
  "license" => { "id" => meta.fetch("license", nil) },
57
57
  "version" => meta.fetch("version", nil),
58
58
  "keywords" => meta.fetch("keywords", nil)
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.15"
2
+ VERSION = "0.9.16"
3
3
  end
@@ -137,6 +137,15 @@ describe Bolognese::Metadata, vcr: true do
137
137
  response = subject.get_one_author(meta.dig("creators", "creator"))
138
138
  expect(response).to eq("type"=>"Person", "name"=>"Dr. Störi, Kunstsalon")
139
139
  end
140
+
141
+ it "name with role" do
142
+ input = "10.14463/GBV:873056442"
143
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
144
+ string = subject.get_datacite(id: input)
145
+ meta = Maremma.from_xml(string).fetch("resource", {})
146
+ response = subject.get_one_author(meta.dig("creators", "creator").first)
147
+ expect(response).to eq("type"=>"Person", "name"=>"H. C. Schumacher", "givenName"=>"H. C.", "familyName"=>"Schumacher")
148
+ end
140
149
  end
141
150
 
142
151
  context "get_name_identifier" do
@@ -0,0 +1,77 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://search.datacite.org/api?fl=doi,xml,media,minted,updated&q=doi:10.14463/gbv:873056442&wt=json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Maremma - https://github.com/datacite/maremma
12
+ Accept:
13
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ''
18
+ headers:
19
+ Access-Control-Allow-Methods:
20
+ - GET, POST, OPTIONS
21
+ Access-Control-Allow-Origin:
22
+ - "*"
23
+ Content-Type:
24
+ - application/json;charset=UTF-8
25
+ Date:
26
+ - Mon, 08 May 2017 05:00:01 GMT
27
+ Server:
28
+ - openresty/1.11.2.2
29
+ Content-Length:
30
+ - '3010'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: '{"responseHeader":{"status":0,"QTime":1},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+CjxyZXNvdXJjZSB4bWxucz0iaHR0cDovL2RhdGFjaXRlLm9yZy9zY2hlbWEva2VybmVsLTIuMiIKICAgICAgICAgICAgIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiCiAgICAgICAgICAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9kYXRhY2l0ZS5vcmcvc2NoZW1hL2tlcm5lbC0yLjIgaHR0cDovL3NjaGVtYS5kYXRhY2l0ZS5vcmcvbWV0YS9rZXJuZWwtMi4yL21ldGFkYXRhLnhzZCI+CiAgICAgIDxpZGVudGlmaWVyIGlkZW50aWZpZXJUeXBlPSJET0kiPjEwLjE0NDYzL0dCVjo4NzMwNTY0NDI8L2lkZW50aWZpZXI+CiAgICAgIDxjcmVhdG9ycz4KICAgICAgICAgPGNyZWF0b3I+CiAgICAgICAgICAgIDxjcmVhdG9yTmFtZT5TY2h1bWFjaGVyLCBILiBDLiAoIEhlcmF1c2dlYmVySW4gKSA8L2NyZWF0b3JOYW1lPgogICAgICAgICA8L2NyZWF0b3I+CiAgICAgICAgIDxjcmVhdG9yPgogICAgICAgICAgICA8Y3JlYXRvck5hbWU+V2FybnN0b3JmZiwgRy4gSC4gTC4gKCBIZXJhdXNnZWJlckluICkgPC9jcmVhdG9yTmFtZT4KICA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VhZ2U+CiAgICAgIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iVGV4dCI+Qm9vazwvcmVzb3VyY2VUeXBlPgogICAgICA8YWx0ZXJuYXRlSWRlbnRpZmllcnM+CiAgICAgICAgIDxhbHRlcm5hdGVJZGVudGlmaWVyIGFsdGVybmF0ZUlkZW50aWZpZXJUeXBlPSJmaXJzdGlkIj5HQlY6ODczMDU2NDQyPC9hbHRlcm5hdGVJZGVudGlmaWVyPgogICAgICAgICA8YWx0ZXJuYXRlSWRlbnRpZmllciBhbHRlcm5hdGVJZGVudGlmaWVyVHlwZT0icHBuIj44NzMwNTY0NDI8L2FsdGVybmF0ZUlkZW50aWZpZXI+CiAgICAgICAgIDxhbHRlcm5hdGVJZGVudGlmaWVyIGFsdGVybmF0ZUlkZW50aWZpZXJUeXBlPSJmdHgtaWQiPlRJQktBVDo4NzMwNTY0NDI8L2FsdGVybmF0ZUlkZW50aWZpZXI+CiAgICAgIDwvYWx0ZXJuYXRlSWRlbnRpZmllcnM+CiAgICAgIDxzaXplcz4KICAgICAgICAgPHNpemU+MSBPbmxpbmUtUmVzc291cmNlICgyMjEsIDMxIFNlaXRlbik8L3NpemU+CiAgICAgIDwvc2l6ZXM+CiAgICAgIDxmb3JtYXRzPgogICAgICAgICA8Zm9ybWF0PmFwcGxpY2F0aW9uL3BkZjwvZm9ybWF0PgogICAgICA8L2Zvcm1hdHM+CiAgICAgIDx2ZXJzaW9uPjEuMDwvdmVyc2lvbj4KICAgICAgPHJpZ2h0cz5UZWNobmlzY2hlIEluZm9ybWF0aW9uc2JpYmxpb3RoZWsgKFRJQik8L3JpZ2h0cz4KICAgPC9yZXNvdXJjZT4=","minted":"2016-11-24T08:00:30Z","updated":"2017-01-23T08:02:26Z","doi":"10.14463/GBV:873056442"}]}}
36
+
37
+ '
38
+ http_version:
39
+ recorded_at: Mon, 08 May 2017 05:00:01 GMT
40
+ - request:
41
+ method: get
42
+ uri: https://search.datacite.org/api?fl=doi,xml,media,minted,updated&q=doi:10.14463/gbv:873056442&wt=json
43
+ body:
44
+ encoding: US-ASCII
45
+ string: ''
46
+ headers:
47
+ User-Agent:
48
+ - Maremma - https://github.com/datacite/maremma
49
+ Accept:
50
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
51
+ response:
52
+ status:
53
+ code: 200
54
+ message: ''
55
+ headers:
56
+ Access-Control-Allow-Methods:
57
+ - GET, POST, OPTIONS
58
+ Access-Control-Allow-Origin:
59
+ - "*"
60
+ Content-Type:
61
+ - application/json;charset=UTF-8
62
+ Date:
63
+ - Mon, 08 May 2017 05:00:01 GMT
64
+ Server:
65
+ - openresty/1.11.2.2
66
+ Content-Length:
67
+ - '3010'
68
+ Connection:
69
+ - keep-alive
70
+ body:
71
+ encoding: UTF-8
72
+ string: '{"responseHeader":{"status":0,"QTime":0},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+CjxyZXNvdXJjZSB4bWxucz0iaHR0cDovL2RhdGFjaXRlLm9yZy9zY2hlbWEva2VybmVsLTIuMiIKICAgICAgICAgICAgIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiCiAgICAgICAgICAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9kYXRhY2l0ZS5vcmcvc2NoZW1hL2tlcm5lbC0yLjIgaHR0cDovL3NjaGVtYS5kYXRhY2l0ZS5vcmcvbWV0YS9rZXJuZWwtMi4yL21ldGFkYXRhLnhzZCI+CiAgICAgIDxpZGVudGlmaWVyIGlkZW50aWZpZXJUeXBlPSJET0kiPjEwLjE0NDYzL0dCVjo4NzMwNTY0NDI8L2lkZW50aWZpZXI+CiAgICAgIDxjcmVhdG9ycz4KICAgICAgICAgPGNyZWF0b3I+CiAgICAgICAgICAgIDxjcmVhdG9yTmFtZ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luZm9ybWF0aW9uc2JpYmxpb3RoZWsgKFRJQik8L3JpZ2h0cz4KICAgPC9yZXNvdXJjZT4=","minted":"2016-11-24T08:00:30Z","updated":"2017-01-23T08:02:26Z","doi":"10.14463/GBV:873056442"}]}}
73
+
74
+ '
75
+ http_version:
76
+ recorded_at: Mon, 08 May 2017 05:00:01 GMT
77
+ recorded_with: VCR 3.0.3
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: 0.9.15
4
+ version: 0.9.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-07 00:00:00.000000000 Z
11
+ date: 2017-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -617,6 +617,7 @@ files:
617
617
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/is_organization.yml
618
618
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/multiple_author_names_in_one_field.yml
619
619
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_affiliation.yml
620
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_one_author/name_with_role.yml
620
621
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/BlogPosting.yml
621
622
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/get_schema_org_metadata/not_found_error.yml
622
623
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/insert_alternate_identifiers/insert.yml