bolognese 0.9.6 → 0.9.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
  SHA1:
3
- metadata.gz: b3d7e93701080fa5283292b961de72db0826a507
4
- data.tar.gz: 49932167206fa2b04e1d16f20097a82264eeb02b
3
+ metadata.gz: a1d9173be073023c912d3d2a912fda4d255d7d69
4
+ data.tar.gz: a38086bc705ab16472df35e2950f1139ec5416a2
5
5
  SHA512:
6
- metadata.gz: 8f98dc3e1fe55fd077ffd166e38db5535181adafaa12117d65894ad88324e12958585f0d23eb3c2aac2cadbf08c44abc3eb4770f4e0a696d5ae73ad183ebc74e
7
- data.tar.gz: c6eb619fef41ba0b811820e590365e238617f6bdad8c312688e9186fdd7a542a04a1e920e53d7c0923502cc3153a86ac4e7dedd5b0fb93f5f165a9119bdc9b18
6
+ metadata.gz: a594ce7e95bcfd9f80bd09869b2b4fc7b0b3de2581f05e04a0c63f2fce0dd23e0c4538c17c2637fffb3aec60ce89bc2d87d30fd63ba2e358b7c7c307df816ad9
7
+ data.tar.gz: 9c903574125858d6c2cb80de55f22167ffbb86d428e541d1a464a4771e8bfb9352cecd45d34cfde4c93f63e289936e59e94c832d3ef0756e830233562bf4ad1b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (0.9.6)
4
+ bolognese (0.9.7)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -106,7 +106,13 @@ module Bolognese
106
106
  end
107
107
 
108
108
  def keywords
109
- Array.wrap(metadata.dig("subjects", "subject")).join(", ").presence
109
+ Array.wrap(metadata.dig("subjects", "subject")).map do |k|
110
+ if k.is_a?(String)
111
+ sanitize(k)
112
+ else
113
+ k.fetch("__content__", nil)
114
+ end
115
+ end.compact.join(", ").presence
110
116
  end
111
117
 
112
118
  def author
@@ -44,6 +44,14 @@ module Bolognese
44
44
  "isBasedOn" => Array.wrap(is_supplement_to).map { |r| { "@id" => r["id"] }}.unwrap }.compact
45
45
  end
46
46
 
47
+ def name
48
+ if title.is_a?(Hash)
49
+ title["text"]
50
+ else
51
+ title
52
+ end
53
+ end
54
+
47
55
  def schema_hsh
48
56
  {
49
57
  "@context" => id.present? ? "http://schema.org" : nil,
@@ -51,7 +59,7 @@ module Bolognese
51
59
  "@id" => id,
52
60
  "url" => url,
53
61
  "additionalType" => additional_type,
54
- "name" => title,
62
+ "name" => name,
55
63
  "alternateName" => alternate_name,
56
64
  "author" => to_schema_org(author),
57
65
  "editor" => editor,
@@ -59,7 +67,7 @@ module Bolognese
59
67
  "license" => license.present? ? license["id"] : nil,
60
68
  "version" => version,
61
69
  "keywords" => keywords,
62
- "language" => language,
70
+ "inLanguage" => language,
63
71
  "contentSize" => content_size,
64
72
  "dateCreated" => date_created,
65
73
  "datePublished" => date_published,
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
@@ -151,6 +151,14 @@ describe Bolognese::Datacite, vcr: true do
151
151
  expect(subject.author.first).to eq("type"=>"Person", "name"=>"Masashi Otani", "givenName"=>"Masashi", "familyName"=>"Otani")
152
152
  end
153
153
 
154
+ it "keywords with attributes" do
155
+ id = "https://doi.org/10.21233/n34n5q"
156
+ subject = Bolognese::Datacite.new(id: id)
157
+ expect(subject.valid?).to be true
158
+ expect(subject.id).to eq("https://doi.org/10.21233/n34n5q")
159
+ expect(subject.keywords).to eq("Paleoecology")
160
+ end
161
+
154
162
  it "Funding schema version 4" do
155
163
  id = "https://doi.org/10.5438/6423"
156
164
  subject = Bolognese::Datacite.new(id: id)
@@ -0,0 +1,38 @@
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.21233/n34n5q&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, 24 Apr 2017 21:16:43 GMT
27
+ Server:
28
+ - openresty/1.11.2.2
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '{"responseHeader":{"status":0,"QTime":4},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyBodHRwOi8vc2NoZW1hLmRhdGFjaXRlLm9yZy9tZXRhL2tlcm5lbC0zL21ldGFkYXRhLnhzZCI+ICA8aWRlbnRpZmllciBpZGVudGlmaWVyVHlwZT0iRE9JIj4xMC4yMTIzMy9OMzRONVE8L2lkZW50aWZpZXI+ICA8Y3JlYXRvcnM+ICAgIDxjcmVhdG9yPiAgICAgIDxjcmVhdG9yTmFtZT5BbmRyZXdzLCBKb2huIFQuPC9jcmVhdG9yTmFtZT4gICAgICA8YWZmaWxpYXRpb24+RGVwYXJ0bWVudCBvZiBHZW9sb2dpY2FsIFNjaWVuY2VzLCBDYW1wdXMgQm94IDI1MCwgVW5pdmVyc2l0eSBvZiBDb2xvcmFkbywgQ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ICA8Z2VvTG9jYXRpb25zPiAgICA8Z2VvTG9jYXRpb24+ICAgICAgPGdlb0xvY2F0aW9uQm94PjYwLjAzIC05OS44NSA2MC4wMyAtOTkuODU8L2dlb0xvY2F0aW9uQm94PiAgICA8L2dlb0xvY2F0aW9uPiAgPC9nZW9Mb2NhdGlvbnM+PC9yZXNvdXJjZT4=","minted":"2017-04-18T01:36:23Z","updated":"2017-04-18T01:36:23Z","doi":"10.21233/N34N5Q"}]}}
34
+
35
+ '
36
+ http_version:
37
+ recorded_at: Mon, 24 Apr 2017 21:16:43 GMT
38
+ 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.6
4
+ version: 0.9.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: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -598,6 +598,7 @@ files:
598
598
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/author_with_scheme.yml
599
599
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/is_identical_to.yml
600
600
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/jsonlint.yml
601
+ - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/keywords_with_attributes.yml
601
602
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/multiple_author_names_in_one_creatorName.yml
602
603
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata/multiple_licenses.yml
603
604
  - spec/fixtures/vcr_cassettes/Bolognese_Datacite/get_metadata_as_bibtex/BlogPosting.yml