cirneco 0.9.12 → 0.9.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +124 -49
  3. data/cirneco.gemspec +5 -4
  4. data/lib/cirneco/api.rb +8 -8
  5. data/lib/cirneco/base.rb +2 -2
  6. data/lib/cirneco/cli.rb +1 -1
  7. data/lib/cirneco/utils.rb +48 -95
  8. data/lib/cirneco/version.rb +1 -1
  9. data/lib/cirneco/work.rb +8 -203
  10. data/spec/api_spec.rb +16 -28
  11. data/spec/doi_spec.rb +9 -11
  12. data/spec/fixtures/cool-dois-minted/index.html +189 -234
  13. data/spec/fixtures/cool-dois-minted.html.md +1 -1
  14. data/spec/fixtures/cool-dois.html.md +2 -2
  15. data/spec/fixtures/index-minted.html +1 -1
  16. data/spec/fixtures/index.html +50 -1
  17. data/spec/fixtures/index.html.erb +2 -2
  18. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_all_dois_by_prefix.yml +20 -18
  19. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/jats/should_generate_jats_for_all_urls.yml +38 -0
  20. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_for_all_urls.yml +20 -20
  21. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_for_url.yml +19 -17
  22. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_metadata_for_work.yml +19 -17
  23. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_and_hide_for_all_urls.yml +204 -108
  24. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_and_hide_for_url.yml +72 -64
  25. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_for_all_urls.yml +17 -291
  26. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_post_metadata_for_work.yml +47 -82
  27. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_all_dois.yml +22 -18
  28. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_doi.yml +19 -17
  29. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/put/should_put_doi.yml +20 -18
  30. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/jats/writes_jats_for_list_of_urls.yml +38 -0
  31. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/hides_a_doi.yml +19 -17
  32. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/hides_dois_for_list_of_urls.yml +81 -0
  33. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_and_hides_a_doi.yml +72 -64
  34. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_and_hides_dois_for_list_of_urls.yml +204 -108
  35. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_dois_for_list_of_urls.yml +17 -291
  36. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_all_dois.yml +140 -18
  37. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi.yml +137 -17
  38. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi_not_found.yml +134 -16
  39. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/username_missing.yml +121 -0
  40. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/put/should_put_doi.yml +138 -18
  41. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/get/should_get_media.yml +135 -17
  42. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/post/should_post_media.yml +137 -17
  43. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml +137 -17
  44. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/get/should_get_metadata.yml +170 -27
  45. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/post/should_post_metadata.yml +173 -28
  46. data/spec/fixtures/vcr_cassettes/Cirneco_Work/media/includes_media.yml +121 -0
  47. data/spec/fixtures/vcr_cassettes/Cirneco_Work/schema/BlogPosting.yml +121 -0
  48. data/spec/spec_helper.rb +1 -1
  49. data/spec/utils_spec.rb +28 -41
  50. data/spec/work_spec.rb +33 -43
  51. metadata +43 -19
  52. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_for_url.yml +0 -174
  53. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_a_doi.yml +0 -174
@@ -45,7 +45,56 @@
45
45
  </script>
46
46
 
47
47
  <script type="application/ld+json">
48
- {"@context":"http://schema.org","@type":"Blog","@id":"https://blog.datacite.org/","name":"DataCite Blog","alternateName":"MS-25-1785","url":"https://blog.datacite.org/","author":[{"@type":"Person","@id":"http://orcid.org/0000-0002-9300-5278","givenName":"Patricia","familyName":"Cruse","name":"Trisha Cruse"},{"@type":"Person","@id":"http://orcid.org/0000-0001-5952-7630","givenName":"Laura","familyName":"Rueda","name":"Laura Rueda"},{"@type":"Person","@id":"http://orcid.org/0000-0003-3484-6875","givenName":"Kristian","familyName":"Garza","name":"Kristian Garza"},{"@type":"Person","@id":"http://orcid.org/0000-0003-1419-2405","givenName":"Martin","familyName":"Fenner","name":"Martin Fenner"}],"publisher":{"@type":"Organization","name":"DataCite"},"dateCreated":"2015-08-03","datePublished":"2015-08-03","dateModified":"2015-08-03","version":"1.0","description":"The DataCite blog.","license":"https://creativecommons.org/licenses/by/4.0/","hasPart":[{"@type":"BlogPosting","@id":"cool-dois.html","name":"Cool DOI's","datePublished":"2016-12-15"}]}
48
+ {
49
+ "@context": "http://schema.org",
50
+ "@type": "Blog",
51
+ "@id": "https://doi.org/10.5438/0000-00SS",
52
+ "name": "DataCite Blog",
53
+ "alternateName": "MS-25-1785",
54
+ "url": "https://blog.datacite.org/",
55
+ "author": [{
56
+ "@type": "Person",
57
+ "@id": "http://orcid.org/0000-0002-9300-5278",
58
+ "givenName": "Patricia",
59
+ "familyName": "Cruse",
60
+ "name": "Trisha Cruse"
61
+ }, {
62
+ "@type": "Person",
63
+ "@id": "http://orcid.org/0000-0001-5952-7630",
64
+ "givenName": "Laura",
65
+ "familyName": "Rueda",
66
+ "name": "Laura Rueda"
67
+ }, {
68
+ "@type": "Person",
69
+ "@id": "http://orcid.org/0000-0003-3484-6875",
70
+ "givenName": "Kristian",
71
+ "familyName": "Garza",
72
+ "name": "Kristian Garza"
73
+ }, {
74
+ "@type": "Person",
75
+ "@id": "http://orcid.org/0000-0003-1419-2405",
76
+ "givenName": "Martin",
77
+ "familyName": "Fenner",
78
+ "name": "Martin Fenner"
79
+ }],
80
+ "publisher": {
81
+ "@type": "Organization",
82
+ "name": "DataCite"
83
+ },
84
+ "dateCreated": "2015-08-03",
85
+ "datePublished": "2015-08-03",
86
+ "dateModified": "2017-07-11",
87
+ "version": "1.0",
88
+ "description": "DataCite staff writes about topics relevant to DataCite members and the wider data citation community.",
89
+ "license": "https://creativecommons.org/licenses/by/4.0/",
90
+ "hasPart": [{
91
+ "@type": "BlogPosting",
92
+ "@id": "https://doi.org/10.5438/55E5-T5C0",
93
+ "name": "Cool DOI's",
94
+ "dateCreated": "2016-12-15",
95
+ "datePublished": "2016-12-15"
96
+ }]
97
+ }
49
98
  </script>
50
99
  </head>
51
100
  <body>
@@ -6,10 +6,10 @@ author:
6
6
  - lrueda
7
7
  - kgarza
8
8
  - mfenner
9
- date: '2015-08-03'
10
9
  accession_number: MS-25-1785
11
- doi: 10.5072/0000-00SS
12
10
  published: false
11
+ date: '2017-07-11'
12
+ doi: 10.5438/0000-00SS
13
13
  ---
14
14
  <div class="container-fluid">
15
15
  <div class="row">
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://mds-sandbox.datacite.org/doi
5
+ uri: https://mds.test.datacite.org/doi
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -16,26 +16,26 @@ http_interactions:
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message: ''
19
+ message: OK
20
20
  headers:
21
- Server:
22
- - openresty/1.11.2.1
23
- Date:
24
- - Mon, 02 Jan 2017 09:16:12 GMT
21
+ Access-Control-Allow-Methods:
22
+ - GET, POST, OPTIONS
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - no-cache, no-store
25
27
  Content-Type:
26
28
  - text/html;charset=UTF-8
27
- Connection:
28
- - keep-alive
29
- Pragma:
30
- - no-cache
29
+ Date:
30
+ - Sat, 22 Jul 2017 06:26:32 GMT
31
31
  Expires:
32
32
  - Thu, 01 Jan 1970 00:00:00 GMT
33
- Cache-Control:
34
- - no-cache, no-store
35
- Access-Control-Allow-Origin:
36
- - "*"
37
- Access-Control-Allow-Methods:
38
- - GET, POST, OPTIONS
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - openresty/1.11.2.2
37
+ Connection:
38
+ - keep-alive
39
39
  body:
40
40
  encoding: UTF-8
41
41
  string: |-
@@ -69,6 +69,7 @@ http_interactions:
69
69
  10.5072/AS75-4EQA
70
70
  10.5072/BVFQ-WN8Z
71
71
  10.5072/BZAK-W7E4
72
+ 10.5072/C569060D-8163-4D69-BEA5-CEE3F8DCC6FBXXXXXXX
72
73
  10.5072/CHN1-2GV1
73
74
  10.5072/DC13-VP4J
74
75
  10.5072/E3S8-K40D
@@ -119,6 +120,8 @@ http_interactions:
119
120
  10.5072/YG5V-06JJ
120
121
  10.5072/YGQG-EN6Y
121
122
  10.5072/YV7E-2TV1
123
+ 10.5438/0000-00SS
124
+ 10.5438/0000-03VC
122
125
  10.5438/0001
123
126
  10.5438/0002
124
127
  10.5438/0003
@@ -553,8 +556,7 @@ http_interactions:
553
556
  10.5438/ZQGA-EWE7
554
557
  10.5438/ZR9Y-K3Z5
555
558
  10.5438/ZSKC-6BC1
556
- 10.5438/ZWSF-4Y7Y
557
559
  10.5438/ZYJN-KXX9
558
560
  http_version:
559
- recorded_at: Mon, 02 Jan 2017 09:16:12 GMT
561
+ recorded_at: Sat, 22 Jul 2017 06:26:31 GMT
560
562
  recorded_with: VCR 3.0.3
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: head
5
+ uri: https://doi.org/10.5438/55E5-T5C0
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: 303
17
+ message: See Other
18
+ headers:
19
+ Server:
20
+ - Apache-Coyote/1.1
21
+ Vary:
22
+ - Accept
23
+ Location:
24
+ - https://blog.datacite.org/cool-dois/
25
+ Expires:
26
+ - Sat, 22 Jul 2017 07:25:52 GMT
27
+ Content-Type:
28
+ - text/html;charset=utf-8
29
+ Content-Length:
30
+ - '157'
31
+ Date:
32
+ - Sat, 22 Jul 2017 07:03:54 GMT
33
+ body:
34
+ encoding: UTF-8
35
+ string: ''
36
+ http_version:
37
+ recorded_at: Sat, 22 Jul 2017 07:03:53 GMT
38
+ recorded_with: VCR 3.0.3
@@ -14,7 +14,7 @@ http_interactions:
14
14
  response:
15
15
  status:
16
16
  code: 303
17
- message: ''
17
+ message: See Other
18
18
  headers:
19
19
  Server:
20
20
  - Apache-Coyote/1.1
@@ -23,21 +23,21 @@ http_interactions:
23
23
  Location:
24
24
  - https://blog.datacite.org/cool-dois/
25
25
  Expires:
26
- - Mon, 02 Jan 2017 21:39:42 GMT
26
+ - Sat, 22 Jul 2017 07:25:52 GMT
27
27
  Content-Type:
28
28
  - text/html;charset=utf-8
29
29
  Content-Length:
30
30
  - '157'
31
31
  Date:
32
- - Mon, 02 Jan 2017 21:21:31 GMT
32
+ - Sat, 22 Jul 2017 07:04:36 GMT
33
33
  body:
34
34
  encoding: UTF-8
35
35
  string: ''
36
36
  http_version:
37
- recorded_at: Mon, 02 Jan 2017 21:21:32 GMT
37
+ recorded_at: Sat, 22 Jul 2017 07:04:35 GMT
38
38
  - request:
39
39
  method: delete
40
- uri: https://mds-sandbox.datacite.org/metadata/10.5072/0000-NW90
40
+ uri: https://mds.test.datacite.org/metadata/10.5438/0000-NW90
41
41
  body:
42
42
  encoding: US-ASCII
43
43
  string: ''
@@ -51,29 +51,29 @@ http_interactions:
51
51
  response:
52
52
  status:
53
53
  code: 404
54
- message: ''
54
+ message: Not Found
55
55
  headers:
56
- Server:
57
- - openresty/1.11.2.1
56
+ Access-Control-Allow-Methods:
57
+ - GET, POST, OPTIONS
58
+ Access-Control-Allow-Origin:
59
+ - "*"
60
+ Cache-Control:
61
+ - no-cache, no-store
58
62
  Date:
59
- - Mon, 02 Jan 2017 21:21:33 GMT
63
+ - Sat, 22 Jul 2017 07:04:36 GMT
64
+ Expires:
65
+ - Thu, 01 Jan 1970 00:00:00 GMT
66
+ Pragma:
67
+ - no-cache
68
+ Server:
69
+ - openresty/1.11.2.2
60
70
  Content-Length:
61
71
  - '17'
62
72
  Connection:
63
73
  - keep-alive
64
- Pragma:
65
- - no-cache
66
- Expires:
67
- - Thu, 01 Jan 1970 00:00:00 GMT
68
- Cache-Control:
69
- - no-cache, no-store
70
- Access-Control-Allow-Origin:
71
- - "*"
72
- Access-Control-Allow-Methods:
73
- - GET, POST, OPTIONS
74
74
  body:
75
75
  encoding: UTF-8
76
76
  string: DOI doesn't exist
77
77
  http_version:
78
- recorded_at: Mon, 02 Jan 2017 21:21:33 GMT
78
+ recorded_at: Sat, 22 Jul 2017 07:04:35 GMT
79
79
  recorded_with: VCR 3.0.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: delete
5
- uri: https://mds-sandbox.datacite.org/metadata/10.5072/0000-03WD
5
+ uri: https://mds.test.datacite.org/metadata/10.5438/55E5-T5C0
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -16,29 +16,31 @@ http_interactions:
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message: ''
19
+ message: OK
20
20
  headers:
21
- Server:
22
- - openresty/1.11.2.1
23
- Date:
24
- - Mon, 02 Jan 2017 21:21:20 GMT
21
+ Access-Control-Allow-Methods:
22
+ - GET, POST, OPTIONS
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - no-cache, no-store
25
27
  Content-Type:
26
28
  - text/html;charset=UTF-8
27
- Connection:
28
- - keep-alive
29
- Pragma:
30
- - no-cache
29
+ Date:
30
+ - Sat, 22 Jul 2017 07:04:34 GMT
31
31
  Expires:
32
32
  - Thu, 01 Jan 1970 00:00:00 GMT
33
- Cache-Control:
34
- - no-cache, no-store
35
- Access-Control-Allow-Origin:
36
- - "*"
37
- Access-Control-Allow-Methods:
38
- - GET, POST, OPTIONS
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - openresty/1.11.2.2
37
+ Content-Length:
38
+ - '2'
39
+ Connection:
40
+ - keep-alive
39
41
  body:
40
42
  encoding: UTF-8
41
43
  string: OK
42
44
  http_version:
43
- recorded_at: Mon, 02 Jan 2017 21:21:20 GMT
45
+ recorded_at: Sat, 22 Jul 2017 07:04:33 GMT
44
46
  recorded_with: VCR 3.0.3
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: delete
5
- uri: https://mds-sandbox.datacite.org/metadata/10.5072/0000-03VC
5
+ uri: https://mds.test.datacite.org/metadata/10.5438/0000-03VC
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -16,29 +16,31 @@ http_interactions:
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message: ''
19
+ message: OK
20
20
  headers:
21
- Server:
22
- - openresty/1.11.2.1
23
- Date:
24
- - Mon, 02 Jan 2017 21:21:37 GMT
21
+ Access-Control-Allow-Methods:
22
+ - GET, POST, OPTIONS
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Cache-Control:
26
+ - no-cache, no-store
25
27
  Content-Type:
26
28
  - text/html;charset=UTF-8
27
- Connection:
28
- - keep-alive
29
- Pragma:
30
- - no-cache
29
+ Date:
30
+ - Sat, 22 Jul 2017 07:04:40 GMT
31
31
  Expires:
32
32
  - Thu, 01 Jan 1970 00:00:00 GMT
33
- Cache-Control:
34
- - no-cache, no-store
35
- Access-Control-Allow-Origin:
36
- - "*"
37
- Access-Control-Allow-Methods:
38
- - GET, POST, OPTIONS
33
+ Pragma:
34
+ - no-cache
35
+ Server:
36
+ - openresty/1.11.2.2
37
+ Content-Length:
38
+ - '2'
39
+ Connection:
40
+ - keep-alive
39
41
  body:
40
42
  encoding: UTF-8
41
43
  string: OK
42
44
  http_version:
43
- recorded_at: Mon, 02 Jan 2017 21:21:37 GMT
45
+ recorded_at: Sat, 22 Jul 2017 07:04:38 GMT
44
46
  recorded_with: VCR 3.0.3