bolognese 0.8.11 → 0.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/utils.rb +10 -5
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Bolognese_Metadata/generate/datacite.yml +173 -0
- data/spec/utils_spec.rb +12 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908ebf930f87a917517af6c80e8e125e298a3356
|
4
|
+
data.tar.gz: e73f82d5defc0eb50f3958f158f2538b51e0ccbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a0f37edfdb9c2ca090c740ae09694b7f193d9934f44826d179c754a884fa7a05af4130f26dbb7663322a947b15387eb39c83581bbd3407fd77ffb069d16008
|
7
|
+
data.tar.gz: 8c5a7f8db36646e15a5beddfdc9bdf13bb45bbfcf098da46faa23320cd6c77fc089b817d6c705f239f11cb32fb4857274af3469bbafe7a7fd907e976e3b35b4d
|
data/Gemfile.lock
CHANGED
data/lib/bolognese/utils.rb
CHANGED
@@ -51,12 +51,10 @@ module Bolognese
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def read(id: nil, string: nil, from: nil, **options)
|
54
|
-
if from.nil?
|
55
|
-
puts "not implemented"
|
56
|
-
return nil
|
57
|
-
end
|
58
|
-
|
59
54
|
p = case from
|
55
|
+
when nil
|
56
|
+
puts "not implemented"
|
57
|
+
return nil
|
60
58
|
when "crossref" then Crossref.new(id: id, string: string)
|
61
59
|
when "datacite" then Datacite.new(id: id, string: string, regenerate: options[:regenerate])
|
62
60
|
when "codemeta" then Codemeta.new(id: id, string: string)
|
@@ -81,6 +79,13 @@ module Bolognese
|
|
81
79
|
puts metadata.send(to)
|
82
80
|
end
|
83
81
|
|
82
|
+
def generate(id: nil, string: nil, from: nil, to: nil, **options)
|
83
|
+
metadata = read(id: id, string: string, from: from, **options)
|
84
|
+
return nil if metadata.nil?
|
85
|
+
|
86
|
+
metadata.send(to)
|
87
|
+
end
|
88
|
+
|
84
89
|
def orcid_from_url(url)
|
85
90
|
Array(/\Ahttp:\/\/orcid\.org\/(.+)/.match(url)).last
|
86
91
|
end
|
data/lib/bolognese/version.rb
CHANGED
@@ -0,0 +1,173 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://doi.org/10.5061/dryad.8515
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Maremma - https://github.com/datacite/maremma
|
12
|
+
Accept:
|
13
|
+
- application/vnd.datacite.datacite+xml
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 303
|
17
|
+
message: ''
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- Apache-Coyote/1.1
|
21
|
+
Vary:
|
22
|
+
- Accept
|
23
|
+
Location:
|
24
|
+
- http://data.datacite.org/10.5061%2Fdryad.8515
|
25
|
+
Expires:
|
26
|
+
- Mon, 10 Apr 2017 19:19:05 GMT
|
27
|
+
Content-Type:
|
28
|
+
- text/html;charset=utf-8
|
29
|
+
Content-Length:
|
30
|
+
- '175'
|
31
|
+
Date:
|
32
|
+
- Mon, 10 Apr 2017 19:17:05 GMT
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: |-
|
36
|
+
<html><head><title>Handle Redirect</title></head>
|
37
|
+
<body><a href="http://data.datacite.org/10.5061%2Fdryad.8515">http://data.datacite.org/10.5061%2Fdryad.8515</a></body></html>
|
38
|
+
http_version:
|
39
|
+
recorded_at: Mon, 10 Apr 2017 19:17:06 GMT
|
40
|
+
- request:
|
41
|
+
method: get
|
42
|
+
uri: http://data.datacite.org/10.5061%2Fdryad.8515
|
43
|
+
body:
|
44
|
+
encoding: US-ASCII
|
45
|
+
string: ''
|
46
|
+
headers:
|
47
|
+
User-Agent:
|
48
|
+
- Maremma - https://github.com/datacite/maremma
|
49
|
+
Accept:
|
50
|
+
- application/vnd.datacite.datacite+xml
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 301
|
54
|
+
message: ''
|
55
|
+
headers:
|
56
|
+
Content-Type:
|
57
|
+
- text/html
|
58
|
+
Date:
|
59
|
+
- Mon, 10 Apr 2017 19:17:06 GMT
|
60
|
+
Location:
|
61
|
+
- https://data.datacite.org/10.5061%2Fdryad.8515
|
62
|
+
Server:
|
63
|
+
- openresty/1.11.2.2
|
64
|
+
Content-Length:
|
65
|
+
- '191'
|
66
|
+
Connection:
|
67
|
+
- keep-alive
|
68
|
+
body:
|
69
|
+
encoding: UTF-8
|
70
|
+
string: "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
|
71
|
+
bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>openresty/1.11.2.2</center>\r\n</body>\r\n</html>\r\n"
|
72
|
+
http_version:
|
73
|
+
recorded_at: Mon, 10 Apr 2017 19:17:06 GMT
|
74
|
+
- request:
|
75
|
+
method: get
|
76
|
+
uri: https://data.datacite.org/10.5061%2Fdryad.8515
|
77
|
+
body:
|
78
|
+
encoding: US-ASCII
|
79
|
+
string: ''
|
80
|
+
headers:
|
81
|
+
User-Agent:
|
82
|
+
- Maremma - https://github.com/datacite/maremma
|
83
|
+
Accept:
|
84
|
+
- application/vnd.datacite.datacite+xml
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 200
|
88
|
+
message: ''
|
89
|
+
headers:
|
90
|
+
Access-Control-Allow-Methods:
|
91
|
+
- GET, POST, OPTIONS
|
92
|
+
Access-Control-Allow-Origin:
|
93
|
+
- "*"
|
94
|
+
Cache-Control:
|
95
|
+
- no-transform, max-age=3600
|
96
|
+
Content-Type:
|
97
|
+
- application/vnd.datacite.datacite+xml
|
98
|
+
Date:
|
99
|
+
- Mon, 10 Apr 2017 19:17:06 GMT
|
100
|
+
Last-Modified:
|
101
|
+
- Sat, 04 Feb 2017 17:54:37 GMT
|
102
|
+
Server:
|
103
|
+
- openresty/1.11.2.2
|
104
|
+
Vary:
|
105
|
+
- Accept
|
106
|
+
Content-Length:
|
107
|
+
- '2601'
|
108
|
+
Connection:
|
109
|
+
- keep-alive
|
110
|
+
body:
|
111
|
+
encoding: ASCII-8BIT
|
112
|
+
string: !binary |-
|
113
|
+
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291
|
114
|
+
cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwt
|
115
|
+
MyIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVt
|
116
|
+
YS1pbnN0YW5jZSIgeG1sbnM6bWV0cz0iaHR0cDovL3d3dy5sb2MuZ292L01F
|
117
|
+
VFMvIiB4bWxuczpkc3BhY2U9Imh0dHA6Ly93d3cuZHNwYWNlLm9yZy94bWxu
|
118
|
+
cy9kc3BhY2UvZGltIiB4bWxuczpkaW09Imh0dHA6Ly93d3cuZHNwYWNlLm9y
|
119
|
+
Zy94bWxucy9kc3BhY2UvZGltIiB4bWxuczpkcnlhZD0iaHR0cDovL3B1cmwu
|
120
|
+
b3JnL2RyeWFkL3Rlcm1zLyIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8v
|
121
|
+
ZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyBodHRwOi8vc2NoZW1hLmRh
|
122
|
+
dGFjaXRlLm9yZy9tZXRhL2tlcm5lbC0zL21ldGFkYXRhLnhzZCI+ICA8aWRl
|
123
|
+
bnRpZmllciBpZGVudGlmaWVyVHlwZT0iRE9JIj4xMC41MDYxL0RSWUFELjg1
|
124
|
+
MTU8L2lkZW50aWZp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4wLyIvPiAgPC9yaWdodHNMaXN0PjwvcmVzb3VyY2U+
|
171
|
+
http_version:
|
172
|
+
recorded_at: Mon, 10 Apr 2017 19:17:06 GMT
|
173
|
+
recorded_with: VCR 3.0.3
|
data/spec/utils_spec.rb
CHANGED
@@ -148,6 +148,18 @@ describe Bolognese::Metadata, vcr: true do
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
+
context "generate" do
|
152
|
+
let(:id) { "https://doi.org/10.5061/DRYAD.8515" }
|
153
|
+
let(:from) { "datacite" }
|
154
|
+
let(:to) { "schema_org" }
|
155
|
+
|
156
|
+
it "datacite" do
|
157
|
+
response = subject.generate(id: id, from: from, to: to)
|
158
|
+
json = JSON.parse(response)
|
159
|
+
expect(json["@id"]).to eq("https://doi.org/10.5061/dryad.8515")
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
151
163
|
context "get_date_parts" do
|
152
164
|
it "date" do
|
153
165
|
date = "2016-12-20"
|
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.8.
|
4
|
+
version: 0.8.12
|
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-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -582,6 +582,7 @@ files:
|
|
582
582
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/crossref_doi_not_url.yml
|
583
583
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite.yml
|
584
584
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/find_from_format_by_ID/datacite_doi_http.yml
|
585
|
+
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/generate/datacite.yml
|
585
586
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/read/datacite.yml
|
586
587
|
- spec/fixtures/vcr_cassettes/Bolognese_Metadata/write/datacite_to_bibtex.yml
|
587
588
|
- spec/fixtures/vcr_cassettes/Bolognese_SchemaOrg/get_metadata/BlogPosting.yml
|