cirneco 0.6.11 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +1 -1
- data/Gemfile.lock +2 -2
- data/data/authors.yml +0 -0
- data/data/references.yaml +0 -0
- data/data/site.yml +0 -0
- data/lib/cirneco/cli.rb +8 -0
- data/lib/cirneco/doi.rb +0 -1
- data/lib/cirneco/utils.rb +31 -41
- data/lib/cirneco/version.rb +1 -1
- data/lib/cirneco/work.rb +15 -1
- data/spec/api_spec.rb +4 -4
- data/spec/doi_spec.rb +14 -8
- data/spec/fixtures/cool-dois.html.md +1 -1
- data/spec/fixtures/site.yml +1 -1
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_all_dois_by_prefix.yml +3 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/{get/should_get_next_doi.yml → mint_and_hide_DOIs/should_hide_metadata_for_work.yml} +5 -17
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_post_metadata_for_work.yml +125 -0
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_all_dois.yml +3 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_doi.yml +3 -3
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/put/should_put_doi.yml +4 -4
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_all_dois.yml +3 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi.yml +3 -3
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/put/should_put_doi.yml +4 -4
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/get/should_get_media.yml +3 -3
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/post/should_post_media.yml +3 -3
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml +3 -3
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/get/should_get_metadata.yml +5 -5
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/post/should_post_metadata.yml +5 -5
- data/spec/utils_spec.rb +28 -16
- data/spec/work_spec.rb +1 -1
- metadata +7 -4
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_number_of_latest_doi.yml +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 016cd10312936fb3ff586472a6aedd2f497ef682
|
4
|
+
data.tar.gz: bb9e4403195692a0e82ffc877f6b988ea1b1a05a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bdb1e1062c2b52b03e76049cb1053199b3391b61cd0309296c7ae3f758ac82a4a1c4cbdb7d4842e5dcd7aa83fca5155bc5e63d763ab697c9f4de027851a77e0
|
7
|
+
data.tar.gz: 17d73fa3880aac9563b003ec38d4ba42bc5c666d3255a47fc74336bffc5fa5e904a3245c8583a212d5cab5cc05a24b0ccfea4be06ca2453bb77ca31bd1f62916
|
data/.env.example
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirneco (0.
|
4
|
+
cirneco (0.7)
|
5
5
|
activesupport (~> 4.2, >= 4.2.5)
|
6
6
|
base32-crockford-checksum (~> 0.2.2)
|
7
7
|
bergamasco (~> 0.2)
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
tzinfo (~> 1.1)
|
23
23
|
addressable (2.3.8)
|
24
24
|
base32-crockford-checksum (0.2.3)
|
25
|
-
bergamasco (0.2.
|
25
|
+
bergamasco (0.2.13)
|
26
26
|
activesupport (~> 4.2, >= 4.2.5)
|
27
27
|
addressable (~> 2.3.8)
|
28
28
|
builder (~> 3.2, >= 3.2.2)
|
data/data/authors.yml
ADDED
File without changes
|
File without changes
|
data/data/site.yml
ADDED
File without changes
|
data/lib/cirneco/cli.rb
CHANGED
@@ -23,6 +23,14 @@ module Cirneco
|
|
23
23
|
true
|
24
24
|
end
|
25
25
|
|
26
|
+
# from http://stackoverflow.com/questions/22809972/adding-a-version-option-to-a-ruby-thor-cli
|
27
|
+
map %w[--version -v] => :__print_version
|
28
|
+
|
29
|
+
desc "--version, -v", "print the version"
|
30
|
+
def __print_version
|
31
|
+
puts Cirneco::VERSION
|
32
|
+
end
|
33
|
+
|
26
34
|
desc "doi SUBCOMMAND", "doi commands"
|
27
35
|
subcommand "doi", Cirneco::Doi
|
28
36
|
|
data/lib/cirneco/doi.rb
CHANGED
@@ -68,7 +68,6 @@ module Cirneco
|
|
68
68
|
method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
|
69
69
|
method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
|
70
70
|
method_option :csl, :default => ENV['SITE_CSLPATH']
|
71
|
-
method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
|
72
71
|
method_option :number, :type => :numeric, :aliases => '-n'
|
73
72
|
method_option :username, :default => ENV['MDS_USERNAME']
|
74
73
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
data/lib/cirneco/utils.rb
CHANGED
@@ -33,19 +33,13 @@ module Cirneco
|
|
33
33
|
return "File #{filename} ignored: not a markdown file" unless File.extname(filepath) == ".md"
|
34
34
|
|
35
35
|
old_metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath)
|
36
|
-
return
|
36
|
+
return "No new DOI minted" if old_metadata["doi"] && old_metadata["published"]
|
37
37
|
|
38
38
|
metadata = generate_metadata_for_work(filepath, options)
|
39
|
-
work =
|
39
|
+
work = post_metadata_for_work(metadata, options)
|
40
40
|
|
41
41
|
return "Errors for DOI #{metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
42
42
|
|
43
|
-
# datapath = options[:datapath] || ENV['DATAPATH'] || "data/doi.yml"
|
44
|
-
# data = Bergamasco::Markdown.read_yaml(datapath) || []
|
45
|
-
# data = [data] if data.is_a?(Hash)
|
46
|
-
# new_data = [{ "filename" => filename, "doi" => doi, "date" => Time.now.utc.iso8601 }]
|
47
|
-
# Bergamasco::Markdown.write_yaml(datapath, data + new_data)
|
48
|
-
|
49
43
|
new_metadata = Bergamasco::Markdown.update_file(filepath, "doi" => metadata["doi"], "published" => true)
|
50
44
|
"DOI #{new_metadata["doi"]} minted for #{filename}"
|
51
45
|
end
|
@@ -57,51 +51,46 @@ module Cirneco
|
|
57
51
|
return "File #{filename} ignored: not a markdown file" unless File.extname(filepath) == ".md"
|
58
52
|
|
59
53
|
old_metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath)
|
60
|
-
return
|
54
|
+
return "No new DOI hidden" unless old_metadata["doi"] && old_metadata["published"]
|
61
55
|
|
62
56
|
metadata = generate_metadata_for_work(filepath, options)
|
63
|
-
work =
|
57
|
+
work = hide_metadata_for_work(metadata, options)
|
64
58
|
|
65
59
|
return "Errors for DOI #{old_metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
66
60
|
|
67
|
-
# datapath = options[:datapath] || ENV['DATAPATH'] || "data/doi.yml"
|
68
|
-
# data = Bergamasco::Markdown.read_yaml(datapath) || []
|
69
|
-
# data = [data] if data.is_a?(Hash)
|
70
|
-
# new_data = [{ "filename" => filename, "doi" => doi, "date" => Time.now.utc.iso8601 }]
|
71
|
-
# Bergamasco::Markdown.write_yaml(datapath, data + new_data)
|
72
|
-
|
73
61
|
new_metadata = Bergamasco::Markdown.update_file(filepath, "published" => false)
|
74
62
|
"DOI #{old_metadata["doi"]} hidden for #{filename}"
|
75
63
|
end
|
76
64
|
|
77
65
|
def mint_dois_for_all_files(folderpath, options={})
|
78
|
-
Dir.glob("#{folderpath}/*.md").map do |filepath|
|
66
|
+
response = Dir.glob("#{folderpath}/*.md").map do |filepath|
|
79
67
|
mint_doi_for_file(filepath, options)
|
80
|
-
end.
|
68
|
+
end.select { |r| r != "No new DOI minted." }
|
69
|
+
response.present? ? response.join("\n") : "No new DOI minted"
|
81
70
|
end
|
82
71
|
|
83
72
|
def hide_dois_for_all_files(folderpath, options={})
|
84
|
-
Dir.glob("#{folderpath}/*.md").map do |filepath|
|
73
|
+
response = Dir.glob("#{folderpath}/*.md").map do |filepath|
|
85
74
|
hide_doi_for_file(filepath, options)
|
86
|
-
end.
|
75
|
+
end.select { |r| r != "No new DOI hidden." }
|
76
|
+
response.present? ? response.join("\n") : "No new DOI hidden"
|
87
77
|
end
|
88
78
|
|
89
79
|
def generate_metadata_for_work(filepath, options={})
|
80
|
+
sitepath = options[:sitepath] || ENV['SITE_SITEPATH'] || "data/site.yml"
|
81
|
+
authorpath = options[:authorpath] || ENV['SITE_AUTHORPATH'] || "data/authors.yml"
|
82
|
+
referencespath = options[:referencespath] || ENV['SITE_REFERENCESPATH'] || "data/references.yaml"
|
83
|
+
csl = options[:csl] || ENV['SITE_CSL'] || "styles/apa.csl"
|
84
|
+
options = options.merge(csl: csl, bibliography: referencespath)
|
85
|
+
|
90
86
|
metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath, options.except(:number))
|
91
87
|
|
92
88
|
return "Error: required metadata missing" unless ["author", "title", "date", "summary"].all? { |k| metadata.key? k }
|
93
89
|
|
94
|
-
# read in optional yaml configuration
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
# read in optional yaml configuration file for authors
|
99
|
-
authorpath = options[:authorpath] || ENV['SITE_AUTHORPATH']
|
100
|
-
author_options = authorpath.present? ? Bergamasco::Markdown.read_yaml(authorpath) : {}
|
101
|
-
|
102
|
-
# read in optional yaml configuration file for references
|
103
|
-
referencespath = options[:referencespath] || ENV['SITE_REFERENCESPATH']
|
104
|
-
references = referencespath.present? ? Bergamasco::Markdown.read_yaml(referencespath) : {}
|
90
|
+
# read in optional yaml configuration files for site, author and references
|
91
|
+
site_options = Bergamasco::Markdown.read_yaml(sitepath) || {}
|
92
|
+
author_options = Bergamasco::Markdown.read_yaml(authorpath) || {}
|
93
|
+
references = Bergamasco::Markdown.read_yaml(referencespath) || {}
|
105
94
|
|
106
95
|
# required metadata
|
107
96
|
prefix = options[:prefix] || site_options["prefix"] || ENV['PREFIX']
|
@@ -184,31 +173,32 @@ module Cirneco
|
|
184
173
|
contributor = site_options["institution"] || ENV['SITE_INSTITUTION']
|
185
174
|
metadata["contributors"] = [{ literal: contributor, contributor_type: "HostingInstitution" }]
|
186
175
|
|
176
|
+
metadata["date_issued"] = metadata["date"]
|
177
|
+
|
187
178
|
metadata = metadata.extract!(*%w(doi url creators title publisher
|
188
179
|
publication_year resource_type descriptions version rights_list subjects contributors
|
189
|
-
related_identifiers))
|
180
|
+
date_issued related_identifiers))
|
190
181
|
end
|
191
182
|
|
192
183
|
def url_from_path(site_url, filepath)
|
193
184
|
site_url.to_s.chomp("\\") + "/" + File.basename(filepath)[0..-9] + "/"
|
194
185
|
end
|
195
186
|
|
196
|
-
def
|
187
|
+
def post_metadata_for_work(metadata, options={})
|
197
188
|
work = Cirneco::Work.new(metadata)
|
189
|
+
return work.validation_errors if work.validation_errors.present?
|
198
190
|
|
199
|
-
|
200
|
-
|
191
|
+
response = work.post_metadata(work.data, options)
|
192
|
+
return response unless response.status == 201
|
201
193
|
|
202
|
-
work
|
194
|
+
work.put_doi(metadata["doi"], options.merge(url: metadata["url"]))
|
203
195
|
end
|
204
196
|
|
205
|
-
def
|
197
|
+
def hide_metadata_for_work(metadata, options={})
|
206
198
|
work = Cirneco::Work.new(metadata)
|
199
|
+
return work.validation_errors if work.validation_errors.present?
|
207
200
|
|
208
|
-
|
209
|
-
File.delete(filename) if File.exist?(filename)
|
210
|
-
|
211
|
-
work
|
201
|
+
work.delete_metadata(metadata["doi"], options)
|
212
202
|
end
|
213
203
|
end
|
214
204
|
end
|
data/lib/cirneco/version.rb
CHANGED
data/lib/cirneco/work.rb
CHANGED
@@ -11,7 +11,7 @@ module Cirneco
|
|
11
11
|
include Cirneco::Api
|
12
12
|
include Cirneco::Utils
|
13
13
|
|
14
|
-
attr_accessor :doi, :url, :creators, :title, :publisher, :publication_year, :resource_type, :version, :related_identifiers, :rights_list, :descriptions, :contributors, :subjects, :media, :username, :password, :validation_errors
|
14
|
+
attr_accessor :doi, :url, :creators, :title, :publisher, :publication_year, :resource_type, :version, :related_identifiers, :rights_list, :descriptions, :contributors, :date_issued, :subjects, :media, :username, :password, :validation_errors
|
15
15
|
|
16
16
|
def initialize(metadata, **options)
|
17
17
|
@doi = metadata.fetch("doi", nil)
|
@@ -23,6 +23,7 @@ module Cirneco
|
|
23
23
|
@resource_type = metadata.fetch("resource_type", nil)
|
24
24
|
@version = metadata.fetch("version", nil)
|
25
25
|
@rights_list = metadata.fetch("rights_list", nil)
|
26
|
+
@date_issued = metadata.fetch("date_issued", nil)
|
26
27
|
@subjects = metadata.fetch("subjects", nil)
|
27
28
|
@descriptions = metadata.fetch("descriptions", nil)
|
28
29
|
@contributors = metadata.fetch("contributors", nil)
|
@@ -53,6 +54,7 @@ module Cirneco
|
|
53
54
|
insert_resource_type(xml)
|
54
55
|
insert_subjects(xml)
|
55
56
|
insert_contributors(xml)
|
57
|
+
insert_dates(xml)
|
56
58
|
insert_related_identifiers(xml)
|
57
59
|
insert_version(xml)
|
58
60
|
insert_rights_list(xml)
|
@@ -117,6 +119,18 @@ module Cirneco
|
|
117
119
|
xml.resourceType(resource_type[:value], 'resourceTypeGeneral' => resource_type[:resource_type_general])
|
118
120
|
end
|
119
121
|
|
122
|
+
def insert_dates(xml)
|
123
|
+
return xml unless date_issued.present?
|
124
|
+
|
125
|
+
xml.dates do
|
126
|
+
insert_date(xml)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def insert_date(xml)
|
131
|
+
xml.date(date_issued, 'dateType' => 'Issued')
|
132
|
+
end
|
133
|
+
|
120
134
|
def insert_subjects(xml)
|
121
135
|
return xml unless subjects.present?
|
122
136
|
|
data/spec/api_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Cirneco::Work, vcr: true, :order => :defined do
|
4
|
-
let(:doi) { "10.
|
4
|
+
let(:doi) { "10.5072/0000-03VC" }
|
5
5
|
let(:url) { "http://www.datacite.org" }
|
6
6
|
let(:creators) { [{ given_name: "Elizabeth", family_name: "Miller", orcid: "0000-0001-5000-0007", affiliation: "DataCite" }] }
|
7
7
|
let(:title) { "Full DataCite XML Example" }
|
@@ -46,9 +46,9 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
46
46
|
context "post" do
|
47
47
|
it 'should post metadata' do
|
48
48
|
response = subject.post_metadata(subject.data, options)
|
49
|
-
expect(response.body["data"]).to eq("OK (10.
|
49
|
+
expect(response.body["data"]).to eq("OK (10.5072/0000-03VC)")
|
50
50
|
expect(response.status).to eq(201)
|
51
|
-
expect(response.headers["Location"]).to eq("https://mds.test.datacite.org/metadata/10.
|
51
|
+
expect(response.headers["Location"]).to eq("https://mds.test.datacite.org/metadata/10.5072/0000-03VC")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -66,7 +66,7 @@ describe Cirneco::Work, vcr: true, :order => :defined do
|
|
66
66
|
it 'should get all dois' do
|
67
67
|
response = subject.get_dois(options)
|
68
68
|
dois = response.body["data"]
|
69
|
-
expect(dois.length).to eq(
|
69
|
+
expect(dois.length).to eq(13)
|
70
70
|
expect(dois.first).to eq("10.23725/0000-03VC")
|
71
71
|
end
|
72
72
|
|
data/spec/doi_spec.rb
CHANGED
@@ -8,13 +8,15 @@ describe Cirneco::Doi do
|
|
8
8
|
|
9
9
|
let(:number) { 123 }
|
10
10
|
let(:prefix) { ENV['PREFIX'] }
|
11
|
-
let(:doi) { "10.
|
11
|
+
let(:doi) { "10.5072/0000-03VC" }
|
12
12
|
let(:url) { "http://www.datacite.org" }
|
13
13
|
let(:filename) { 'cool-dois.html.md' }
|
14
14
|
let(:filepath) { fixture_path + filename }
|
15
15
|
let(:username) { ENV['MDS_USERNAME'] }
|
16
16
|
let(:password) { ENV['MDS_PASSWORD'] }
|
17
17
|
let(:sandbox) { ENV['SANDBOX'] }
|
18
|
+
let(:csl) { "spec/fixtures/apa.csl" }
|
19
|
+
let(:bibliography) { "spec/fixtures/bibliography.yaml" }
|
18
20
|
let(:api_options) { { username: username, password: password, sandbox: true } }
|
19
21
|
|
20
22
|
describe "MDS DOI API", vcr: true, :order => :defined do
|
@@ -28,7 +30,7 @@ describe Cirneco::Doi do
|
|
28
30
|
context "get" do
|
29
31
|
it 'should get all dois' do
|
30
32
|
subject.options = api_options
|
31
|
-
expect { subject.get "all" }.to output("10.23725/0000-03VC\n10.23725/0000-0A53\n10.23725/GQZDGNZW\n10.23725/MDS-CLIENT-RUBY-TEST\n10.5438/0001\n10.5438/0002\n10.5438/0003\n10.5438/0004\n10.5438/0005\n10.5438/0006\n10.5438/EXAMPLE-FULL\n10.5438/MDS-CLIENT-RUBY-TEST\n").to_stdout
|
33
|
+
expect { subject.get "all" }.to output("10.23725/0000-03VC\n10.23725/0000-0A53\n10.23725/GQZDGNZW\n10.23725/MDS-CLIENT-RUBY-TEST\n10.5072/0000-03VC\n10.5438/0001\n10.5438/0002\n10.5438/0003\n10.5438/0004\n10.5438/0005\n10.5438/0006\n10.5438/EXAMPLE-FULL\n10.5438/MDS-CLIENT-RUBY-TEST\n").to_stdout
|
32
34
|
end
|
33
35
|
|
34
36
|
it 'should get doi' do
|
@@ -46,7 +48,7 @@ describe Cirneco::Doi do
|
|
46
48
|
context "base32" do
|
47
49
|
it 'generates a doi' do
|
48
50
|
subject.options = { number: number, prefix: prefix }
|
49
|
-
expect { subject.generate }.to output("10.
|
51
|
+
expect { subject.generate }.to output("10.5072/0000-03VC\n").to_stdout
|
50
52
|
end
|
51
53
|
|
52
54
|
it 'requires a prefix' do
|
@@ -59,26 +61,30 @@ describe Cirneco::Doi do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
it 'checks a doi invalid checksum' do
|
62
|
-
doi = "
|
64
|
+
doi = "5072/0000-03VA"
|
63
65
|
expect { subject.check doi }.to output("Checksum for #{doi} is not valid\n").to_stdout
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
67
69
|
context "mint and hide DOIs", :order => :defined do
|
68
70
|
it 'mints a doi' do
|
69
|
-
|
71
|
+
subject.options = { csl: csl, bibliography: bibliography }
|
72
|
+
expect { subject.mint filepath }.to output("DOI 10.5072/0000-03VC minted for #{filename}\n").to_stdout
|
70
73
|
end
|
71
74
|
|
72
75
|
it 'hides a doi' do
|
73
|
-
|
76
|
+
subject.options = { csl: csl, bibliography: bibliography }
|
77
|
+
expect { subject.hide filepath }.to output("DOI 10.5072/0000-03VC hidden for #{filename}\n").to_stdout
|
74
78
|
end
|
75
79
|
|
76
80
|
it 'mints dois for contents of a folder' do
|
77
|
-
|
81
|
+
subject.options = { csl: csl, bibliography: bibliography }
|
82
|
+
expect { subject.mint fixture_path }.to output("DOI 10.5072/0000-03VC minted for #{filename}\n").to_stdout
|
78
83
|
end
|
79
84
|
|
80
85
|
it 'hides dois for contents of a folder' do
|
81
|
-
|
86
|
+
subject.options = { csl: csl, bibliography: bibliography }
|
87
|
+
expect { subject.hide fixture_path }.to output("DOI 10.5072/0000-03VC hidden for #{filename}\n").to_stdout
|
82
88
|
end
|
83
89
|
|
84
90
|
it 'should ignore non-markdown file for mint file' do
|
@@ -7,7 +7,7 @@ tags:
|
|
7
7
|
- doi
|
8
8
|
- featured
|
9
9
|
image: https://blog.datacite.org/images/2016/12/cool-dois.png
|
10
|
-
doi: 10.
|
10
|
+
doi: 10.5072/0000-03VC
|
11
11
|
published: false
|
12
12
|
---
|
13
13
|
In 1998 Tim Berners-Lee coined the term cool URIs [-@https://www.w3.org/Provider/Style/URI], that is URIs that don’t change. We know that URLs referenced in the scholarly literature are often not cool, leading to link rot [@https://doi.org/10.1371/journal.pone.0115253] and making it hard or impossible to find the referenced resource.READMORE
|
data/spec/fixtures/site.yml
CHANGED
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:32 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -39,6 +39,7 @@ http_interactions:
|
|
39
39
|
10.23725/0000-0A53
|
40
40
|
10.23725/GQZDGNZW
|
41
41
|
10.23725/MDS-CLIENT-RUBY-TEST
|
42
|
+
10.5072/0000-03VC
|
42
43
|
10.5438/0001
|
43
44
|
10.5438/0002
|
44
45
|
10.5438/0003
|
@@ -48,5 +49,5 @@ http_interactions:
|
|
48
49
|
10.5438/EXAMPLE-FULL
|
49
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
50
51
|
http_version:
|
51
|
-
recorded_at:
|
52
|
+
recorded_at: Mon, 19 Dec 2016 06:31:32 GMT
|
52
53
|
recorded_with: VCR 3.0.3
|
@@ -1,8 +1,8 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://mds.test.datacite.org/
|
4
|
+
method: delete
|
5
|
+
uri: https://mds.test.datacite.org/metadata/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:46:24 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -34,19 +34,7 @@ http_interactions:
|
|
34
34
|
- no-cache, no-store
|
35
35
|
body:
|
36
36
|
encoding: UTF-8
|
37
|
-
string:
|
38
|
-
10.23725/0000-03VC
|
39
|
-
10.23725/0000-0A53
|
40
|
-
10.23725/GQZDGNZW
|
41
|
-
10.23725/MDS-CLIENT-RUBY-TEST
|
42
|
-
10.5438/0001
|
43
|
-
10.5438/0002
|
44
|
-
10.5438/0003
|
45
|
-
10.5438/0004
|
46
|
-
10.5438/0005
|
47
|
-
10.5438/0006
|
48
|
-
10.5438/EXAMPLE-FULL
|
49
|
-
10.5438/MDS-CLIENT-RUBY-TEST
|
37
|
+
string: OK
|
50
38
|
http_version:
|
51
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 19 Dec 2016 06:46:24 GMT
|
52
40
|
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,125 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://mds.test.datacite.org/metadata
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: |
|
9
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
10
|
+
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
11
|
+
<identifier identifierType="DOI">10.5072/0000-03VC</identifier>
|
12
|
+
<creators>
|
13
|
+
<creator>
|
14
|
+
<creatorName>Fenner, Martin</creatorName>
|
15
|
+
<givenName>Martin</givenName>
|
16
|
+
<familyName>Fenner</familyName>
|
17
|
+
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID">0000-0003-1419-2405</nameIdentifier>
|
18
|
+
</creator>
|
19
|
+
</creators>
|
20
|
+
<titles>
|
21
|
+
<title>Cool DOI's</title>
|
22
|
+
</titles>
|
23
|
+
<publisher>DataCite Blog</publisher>
|
24
|
+
<publicationYear>2016</publicationYear>
|
25
|
+
<resourceType resourceTypeGeneral="Text">BlogPosting</resourceType>
|
26
|
+
<subjects>
|
27
|
+
<subject>doi</subject>
|
28
|
+
</subjects>
|
29
|
+
<contributors>
|
30
|
+
<contributor contributorType="HostingInstitution">
|
31
|
+
<contributorName>DataCite</contributorName>
|
32
|
+
</contributor>
|
33
|
+
</contributors>
|
34
|
+
<dates>
|
35
|
+
<date dateType="Issued">2016-12-15</date>
|
36
|
+
</dates>
|
37
|
+
<relatedIdentifiers>
|
38
|
+
<relatedIdentifier relatedIdentifierType="URL" relationType="References">https://www.w3.org/Provider/Style/URI</relatedIdentifier>
|
39
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="References">10.1371/JOURNAL.PONE.0115253</relatedIdentifier>
|
40
|
+
</relatedIdentifiers>
|
41
|
+
<version>1.0</version>
|
42
|
+
<rightsList>
|
43
|
+
<rights rightsURI="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution</rights>
|
44
|
+
</rightsList>
|
45
|
+
<descriptions>
|
46
|
+
<description descriptionType="Abstract">In 1998 Tim Berners-Lee coined the term cool URIs (1998), that is URIs that don’t change. We know that URLs referenced in the scholarly literature are often not cool, leading to link rot (Klein et al., 2014) and making it hard or impossible to find the referenced resource.</description>
|
47
|
+
</descriptions>
|
48
|
+
</resource>
|
49
|
+
headers:
|
50
|
+
User-Agent:
|
51
|
+
- Maremma - https://github.com/datacite/maremma
|
52
|
+
Content-Type:
|
53
|
+
- application/xml;charset=UTF-8
|
54
|
+
Accept:
|
55
|
+
- text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
|
56
|
+
Authorization:
|
57
|
+
- Basic <MDS_TOKEN>
|
58
|
+
response:
|
59
|
+
status:
|
60
|
+
code: 201
|
61
|
+
message: ''
|
62
|
+
headers:
|
63
|
+
Server:
|
64
|
+
- nginx/1.4.6 (Ubuntu)
|
65
|
+
Date:
|
66
|
+
- Mon, 19 Dec 2016 06:59:48 GMT
|
67
|
+
Content-Type:
|
68
|
+
- text/html;charset=UTF-8
|
69
|
+
Location:
|
70
|
+
- https://mds.test.datacite.org/metadata/10.5072/0000-03VC
|
71
|
+
Connection:
|
72
|
+
- keep-alive
|
73
|
+
Pragma:
|
74
|
+
- no-cache
|
75
|
+
Expires:
|
76
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
77
|
+
Cache-Control:
|
78
|
+
- no-cache, no-store
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: OK (10.5072/0000-03VC)
|
82
|
+
http_version:
|
83
|
+
recorded_at: Mon, 19 Dec 2016 06:59:48 GMT
|
84
|
+
- request:
|
85
|
+
method: put
|
86
|
+
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
87
|
+
body:
|
88
|
+
encoding: UTF-8
|
89
|
+
string: |-
|
90
|
+
doi=10.5072/0000-03VC
|
91
|
+
url=https://blog.datacite.org/cool-dois/
|
92
|
+
headers:
|
93
|
+
User-Agent:
|
94
|
+
- Maremma - https://github.com/datacite/maremma
|
95
|
+
Content-Type:
|
96
|
+
- text/plain;charset=UTF-8
|
97
|
+
Accept:
|
98
|
+
- text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
|
99
|
+
Authorization:
|
100
|
+
- Basic <MDS_TOKEN>
|
101
|
+
response:
|
102
|
+
status:
|
103
|
+
code: 201
|
104
|
+
message: ''
|
105
|
+
headers:
|
106
|
+
Server:
|
107
|
+
- nginx/1.4.6 (Ubuntu)
|
108
|
+
Date:
|
109
|
+
- Mon, 19 Dec 2016 06:59:49 GMT
|
110
|
+
Content-Type:
|
111
|
+
- text/html;charset=UTF-8
|
112
|
+
Connection:
|
113
|
+
- keep-alive
|
114
|
+
Pragma:
|
115
|
+
- no-cache
|
116
|
+
Expires:
|
117
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
118
|
+
Cache-Control:
|
119
|
+
- no-cache, no-store
|
120
|
+
body:
|
121
|
+
encoding: UTF-8
|
122
|
+
string: OK
|
123
|
+
http_version:
|
124
|
+
recorded_at: Mon, 19 Dec 2016 06:59:49 GMT
|
125
|
+
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:32 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -39,6 +39,7 @@ http_interactions:
|
|
39
39
|
10.23725/0000-0A53
|
40
40
|
10.23725/GQZDGNZW
|
41
41
|
10.23725/MDS-CLIENT-RUBY-TEST
|
42
|
+
10.5072/0000-03VC
|
42
43
|
10.5438/0001
|
43
44
|
10.5438/0002
|
44
45
|
10.5438/0003
|
@@ -48,5 +49,5 @@ http_interactions:
|
|
48
49
|
10.5438/EXAMPLE-FULL
|
49
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
50
51
|
http_version:
|
51
|
-
recorded_at:
|
52
|
+
recorded_at: Mon, 19 Dec 2016 06:31:32 GMT
|
52
53
|
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://mds.test.datacite.org/doi/10.
|
5
|
+
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:32 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: http://www.datacite.org
|
38
38
|
http_version:
|
39
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 19 Dec 2016 06:31:32 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -2,11 +2,11 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: put
|
5
|
-
uri: https://mds.test.datacite.org/doi/10.
|
5
|
+
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: |-
|
9
|
-
doi=10.
|
9
|
+
doi=10.5072/0000-03VC
|
10
10
|
url=http://www.datacite.org
|
11
11
|
headers:
|
12
12
|
User-Agent:
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
25
25
|
Server:
|
26
26
|
- nginx/1.4.6 (Ubuntu)
|
27
27
|
Date:
|
28
|
-
-
|
28
|
+
- Mon, 19 Dec 2016 06:31:31 GMT
|
29
29
|
Content-Type:
|
30
30
|
- text/html;charset=UTF-8
|
31
31
|
Connection:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
encoding: UTF-8
|
41
41
|
string: OK
|
42
42
|
http_version:
|
43
|
-
recorded_at:
|
43
|
+
recorded_at: Mon, 19 Dec 2016 06:31:31 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:24 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -39,6 +39,7 @@ http_interactions:
|
|
39
39
|
10.23725/0000-0A53
|
40
40
|
10.23725/GQZDGNZW
|
41
41
|
10.23725/MDS-CLIENT-RUBY-TEST
|
42
|
+
10.5072/0000-03VC
|
42
43
|
10.5438/0001
|
43
44
|
10.5438/0002
|
44
45
|
10.5438/0003
|
@@ -48,5 +49,5 @@ http_interactions:
|
|
48
49
|
10.5438/EXAMPLE-FULL
|
49
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
50
51
|
http_version:
|
51
|
-
recorded_at:
|
52
|
+
recorded_at: Mon, 19 Dec 2016 06:31:25 GMT
|
52
53
|
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://mds.test.datacite.org/doi/10.
|
5
|
+
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:24 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: http://www.datacite.org
|
38
38
|
http_version:
|
39
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 19 Dec 2016 06:31:25 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -2,11 +2,11 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: put
|
5
|
-
uri: https://mds.test.datacite.org/doi/10.
|
5
|
+
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: |-
|
9
|
-
doi=10.
|
9
|
+
doi=10.5072/0000-03VC
|
10
10
|
url=http://www.datacite.org
|
11
11
|
headers:
|
12
12
|
User-Agent:
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
25
25
|
Server:
|
26
26
|
- nginx/1.4.6 (Ubuntu)
|
27
27
|
Date:
|
28
|
-
-
|
28
|
+
- Mon, 19 Dec 2016 06:31:24 GMT
|
29
29
|
Content-Type:
|
30
30
|
- text/html;charset=UTF-8
|
31
31
|
Connection:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
encoding: UTF-8
|
41
41
|
string: OK
|
42
42
|
http_version:
|
43
|
-
recorded_at:
|
43
|
+
recorded_at: Mon, 19 Dec 2016 06:31:25 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://mds.test.datacite.org/media/10.
|
5
|
+
uri: https://mds.test.datacite.org/media/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:25 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/xml;charset=UTF-8
|
27
27
|
Content-Length:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
|
41
41
|
'
|
42
42
|
http_version:
|
43
|
-
recorded_at:
|
43
|
+
recorded_at: Mon, 19 Dec 2016 06:31:25 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://mds.test.datacite.org/media/10.
|
5
|
+
uri: https://mds.test.datacite.org/media/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
8
|
string: application/pdf=http://www.datacite.org/cirneco-test.pdf
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
Server:
|
24
24
|
- nginx/1.4.6 (Ubuntu)
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Mon, 19 Dec 2016 06:31:24 GMT
|
27
27
|
Content-Type:
|
28
28
|
- text/html;charset=UTF-8
|
29
29
|
Connection:
|
@@ -38,5 +38,5 @@ http_interactions:
|
|
38
38
|
encoding: UTF-8
|
39
39
|
string: OK
|
40
40
|
http_version:
|
41
|
-
recorded_at:
|
41
|
+
recorded_at: Mon, 19 Dec 2016 06:31:25 GMT
|
42
42
|
recorded_with: VCR 3.0.3
|
data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: delete
|
5
|
-
uri: https://mds.test.datacite.org/metadata/10.
|
5
|
+
uri: https://mds.test.datacite.org/metadata/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:23 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: OK
|
38
38
|
http_version:
|
39
|
-
recorded_at:
|
39
|
+
recorded_at: Mon, 19 Dec 2016 06:31:24 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://mds.test.datacite.org/metadata/10.
|
5
|
+
uri: https://mds.test.datacite.org/metadata/10.5072/0000-03VC
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,11 +21,11 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 19 Dec 2016 06:31:23 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/xml;charset=UTF-8
|
27
27
|
Content-Length:
|
28
|
-
- '
|
28
|
+
- '849'
|
29
29
|
Connection:
|
30
30
|
- keep-alive
|
31
31
|
Pragma:
|
@@ -39,7 +39,7 @@ http_interactions:
|
|
39
39
|
string: |
|
40
40
|
<?xml version="1.0" encoding="UTF-8"?>
|
41
41
|
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
42
|
-
<identifier identifierType="DOI">10.
|
42
|
+
<identifier identifierType="DOI">10.5072/0000-03VC</identifier>
|
43
43
|
<creators>
|
44
44
|
<creator>
|
45
45
|
<creatorName>Miller, Elizabeth</creatorName>
|
@@ -56,5 +56,5 @@ http_interactions:
|
|
56
56
|
<resourceType resourceTypeGeneral="Software">XML</resourceType>
|
57
57
|
</resource>
|
58
58
|
http_version:
|
59
|
-
recorded_at:
|
59
|
+
recorded_at: Mon, 19 Dec 2016 06:31:24 GMT
|
60
60
|
recorded_with: VCR 3.0.3
|
@@ -8,7 +8,7 @@ http_interactions:
|
|
8
8
|
string: |
|
9
9
|
<?xml version="1.0" encoding="UTF-8"?>
|
10
10
|
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
11
|
-
<identifier identifierType="DOI">10.
|
11
|
+
<identifier identifierType="DOI">10.5072/0000-03VC</identifier>
|
12
12
|
<creators>
|
13
13
|
<creator>
|
14
14
|
<creatorName>Miller, Elizabeth</creatorName>
|
@@ -41,11 +41,11 @@ http_interactions:
|
|
41
41
|
Server:
|
42
42
|
- nginx/1.4.6 (Ubuntu)
|
43
43
|
Date:
|
44
|
-
-
|
44
|
+
- Mon, 19 Dec 2016 06:31:23 GMT
|
45
45
|
Content-Type:
|
46
46
|
- text/html;charset=UTF-8
|
47
47
|
Location:
|
48
|
-
- https://mds.test.datacite.org/metadata/10.
|
48
|
+
- https://mds.test.datacite.org/metadata/10.5072/0000-03VC
|
49
49
|
Connection:
|
50
50
|
- keep-alive
|
51
51
|
Pragma:
|
@@ -56,7 +56,7 @@ http_interactions:
|
|
56
56
|
- no-cache, no-store
|
57
57
|
body:
|
58
58
|
encoding: UTF-8
|
59
|
-
string: OK (10.
|
59
|
+
string: OK (10.5072/0000-03VC)
|
60
60
|
http_version:
|
61
|
-
recorded_at:
|
61
|
+
recorded_at: Mon, 19 Dec 2016 06:31:24 GMT
|
62
62
|
recorded_with: VCR 3.0.3
|
data/spec/utils_spec.rb
CHANGED
@@ -4,6 +4,8 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
4
4
|
let(:prefix) { ENV['PREFIX'] }
|
5
5
|
let(:username) { ENV['MDS_USERNAME'] }
|
6
6
|
let(:password) { ENV['MDS_PASSWORD'] }
|
7
|
+
let(:csl) { "spec/fixtures/apa.csl" }
|
8
|
+
let(:bibliography) { "spec/fixtures/bibliography.yaml" }
|
7
9
|
let(:options) { { username: username, password: password, sandbox: true } }
|
8
10
|
|
9
11
|
subject { Cirneco::DataCenter.new(prefix: prefix,
|
@@ -14,14 +16,14 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
14
16
|
it 'should get all dois by prefix' do
|
15
17
|
response = subject.get_dois_by_prefix(prefix, options)
|
16
18
|
dois = response.body["data"]
|
17
|
-
expect(dois.length).to eq(
|
18
|
-
expect(dois.first).to eq("10.
|
19
|
+
expect(dois.length).to eq(1)
|
20
|
+
expect(dois.first).to eq("10.5072/0000-03VC")
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
context "base32" do
|
23
25
|
it 'should decode doi' do
|
24
|
-
doi = "10.
|
26
|
+
doi = "10.5072/0000-03WD"
|
25
27
|
expect(subject.decode_doi(doi)).to eq(124)
|
26
28
|
end
|
27
29
|
|
@@ -32,11 +34,11 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
32
34
|
|
33
35
|
it 'should encode doi' do
|
34
36
|
number = 123
|
35
|
-
expect(subject.encode_doi(prefix, number: number)).to eq("10.
|
37
|
+
expect(subject.encode_doi(prefix, number: number)).to eq("10.5072/0000-03VC")
|
36
38
|
end
|
37
39
|
|
38
40
|
it 'should encode doi random number' do
|
39
|
-
expect(subject.encode_doi(prefix)).to start_with("10.
|
41
|
+
expect(subject.encode_doi(prefix)).to start_with("10.5072")
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -44,26 +46,26 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
44
46
|
it 'should mint for file' do
|
45
47
|
filepath = fixture_path + 'cool-dois.html.md'
|
46
48
|
number = 123
|
47
|
-
response = subject.mint_doi_for_file(filepath, number: number)
|
48
|
-
expect(response).to eq("DOI 10.
|
49
|
+
response = subject.mint_doi_for_file(filepath, number: number, csl: csl, bibliography: bibliography)
|
50
|
+
expect(response).to eq("DOI 10.5072/0000-03VC minted for cool-dois.html.md")
|
49
51
|
end
|
50
52
|
|
51
53
|
it 'should hide for file' do
|
52
54
|
filepath = fixture_path + 'cool-dois.html.md'
|
53
|
-
response = subject.hide_doi_for_file(filepath)
|
54
|
-
expect(response).to eq("DOI 10.
|
55
|
+
response = subject.hide_doi_for_file(filepath, csl: csl, bibliography: bibliography)
|
56
|
+
expect(response).to eq("DOI 10.5072/0000-03VC hidden for cool-dois.html.md")
|
55
57
|
end
|
56
58
|
|
57
59
|
it 'should mint for all files' do
|
58
60
|
number = 123
|
59
|
-
response = subject.mint_dois_for_all_files(fixture_path, number: number)
|
60
|
-
expect(response).to eq("DOI 10.
|
61
|
+
response = subject.mint_dois_for_all_files(fixture_path, number: number, csl: csl, bibliography: bibliography)
|
62
|
+
expect(response).to eq("DOI 10.5072/0000-03VC minted for cool-dois.html.md")
|
61
63
|
end
|
62
64
|
|
63
65
|
it 'should hide for all files' do
|
64
66
|
number = 123
|
65
|
-
response = subject.hide_dois_for_all_files(fixture_path)
|
66
|
-
expect(response).to eq("DOI 10.
|
67
|
+
response = subject.hide_dois_for_all_files(fixture_path, csl: csl, bibliography: bibliography)
|
68
|
+
expect(response).to eq("DOI 10.5072/0000-03VC hidden for cool-dois.html.md")
|
67
69
|
end
|
68
70
|
|
69
71
|
it 'should ignore non-markdown file for mint file' do
|
@@ -93,12 +95,22 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
93
95
|
:relation_type=>"References" }])
|
94
96
|
end
|
95
97
|
|
96
|
-
it 'should
|
98
|
+
it 'should post_metadata_for_work' do
|
99
|
+
filepath = fixture_path + 'cool-dois.html.md'
|
100
|
+
number = 123
|
101
|
+
metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
|
102
|
+
response = subject.post_metadata_for_work(metadata, options)
|
103
|
+
expect(response.body["data"]).to eq("OK")
|
104
|
+
expect(response.status).to eq(201)
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should hide_metadata_for_work' do
|
97
108
|
filepath = fixture_path + 'cool-dois.html.md'
|
98
109
|
number = 123
|
99
110
|
metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
|
100
|
-
|
101
|
-
expect(
|
111
|
+
response = subject.hide_metadata_for_work(metadata, options)
|
112
|
+
expect(response.body["data"]).to eq("OK")
|
113
|
+
expect(response.status).to eq(200)
|
102
114
|
end
|
103
115
|
end
|
104
116
|
end
|
data/spec/work_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Cirneco::Work, vcr: true do
|
4
|
-
let(:doi) { "10.
|
4
|
+
let(:doi) { "10.5072/0000-03VC" }
|
5
5
|
let(:url) { "http://www.datacite.org" }
|
6
6
|
let(:creators) { [{ given_name: "Elizabeth", family_name: "Miller", orcid: "0000-0001-5000-0007" }] }
|
7
7
|
let(:title) { "Full DataCite XML Example" }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirneco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.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: 2016-12-
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -308,6 +308,9 @@ files:
|
|
308
308
|
- Rakefile
|
309
309
|
- bin/cirneco
|
310
310
|
- cirneco.gemspec
|
311
|
+
- data/authors.yml
|
312
|
+
- data/references.yaml
|
313
|
+
- data/site.yml
|
311
314
|
- lib/cirneco.rb
|
312
315
|
- lib/cirneco/api.rb
|
313
316
|
- lib/cirneco/base.rb
|
@@ -350,8 +353,8 @@ files:
|
|
350
353
|
- spec/fixtures/references.yaml
|
351
354
|
- spec/fixtures/site.yml
|
352
355
|
- spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_all_dois_by_prefix.yml
|
353
|
-
- spec/fixtures/vcr_cassettes/Cirneco_DataCenter/
|
354
|
-
- spec/fixtures/vcr_cassettes/Cirneco_DataCenter/
|
356
|
+
- spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_metadata_for_work.yml
|
357
|
+
- spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_post_metadata_for_work.yml
|
355
358
|
- spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_all_dois.yml
|
356
359
|
- spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_doi.yml
|
357
360
|
- spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/put/should_put_doi.yml
|
@@ -1,52 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: https://mds.test.datacite.org/doi
|
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
|
-
Authorization:
|
15
|
-
- Basic <MDS_TOKEN>
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: ''
|
20
|
-
headers:
|
21
|
-
Server:
|
22
|
-
- nginx/1.4.6 (Ubuntu)
|
23
|
-
Date:
|
24
|
-
- Sun, 11 Dec 2016 18:35:37 GMT
|
25
|
-
Content-Type:
|
26
|
-
- text/html;charset=UTF-8
|
27
|
-
Connection:
|
28
|
-
- keep-alive
|
29
|
-
Pragma:
|
30
|
-
- no-cache
|
31
|
-
Expires:
|
32
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
33
|
-
Cache-Control:
|
34
|
-
- no-cache, no-store
|
35
|
-
body:
|
36
|
-
encoding: UTF-8
|
37
|
-
string: |-
|
38
|
-
10.23725/0000-03VC
|
39
|
-
10.23725/0000-0A53
|
40
|
-
10.23725/GQZDGNZW
|
41
|
-
10.23725/MDS-CLIENT-RUBY-TEST
|
42
|
-
10.5438/0001
|
43
|
-
10.5438/0002
|
44
|
-
10.5438/0003
|
45
|
-
10.5438/0004
|
46
|
-
10.5438/0005
|
47
|
-
10.5438/0006
|
48
|
-
10.5438/EXAMPLE-FULL
|
49
|
-
10.5438/MDS-CLIENT-RUBY-TEST
|
50
|
-
http_version:
|
51
|
-
recorded_at: Sun, 11 Dec 2016 18:35:37 GMT
|
52
|
-
recorded_with: VCR 3.0.3
|