orcid_client 0.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12b2fc21cb92147d5a8e1de1b1e01477a87249f7
|
4
|
+
data.tar.gz: 6ccd0ca2d3ee093c69281dabb61a42c50ac4ff59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9092ec06f1d44f46393a0e34e1137c4217d99c448604f91fb73957728fbd2fb349e1faec163c05c7f6959d87ccc8522660499aff0fefd52c108fe2e8375b0f69
|
7
|
+
data.tar.gz: f6012a2d508cbf3b9531247458a71192edc17ed93a0364156728c08ca8b076ea7f9cdc27694b586f66ef00b3b84e1023581655d9c6a7e174fad32f209a63e448
|
data/Gemfile.lock
CHANGED
data/lib/orcid_client/api.rb
CHANGED
@@ -60,6 +60,16 @@ module OrcidClient
|
|
60
60
|
response
|
61
61
|
end
|
62
62
|
|
63
|
+
def delete_external_identifier(options={})
|
64
|
+
return OpenStruct.new(body: { "errors" => [{ "title" => "Access token missing" }] }) unless access_token.present?
|
65
|
+
return OpenStruct.new(body: { "errors" => [{ "title" => "Put code missing" }] }) unless put_code.present?
|
66
|
+
|
67
|
+
orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
|
68
|
+
|
69
|
+
url = "#{orcid_api_url}/v#{API_VERSION}/#{orcid}/external-identifiers/#{put_code}"
|
70
|
+
response = Maremma.delete(url, content_type: 'application/vnd.orcid+xml', bearer: access_token)
|
71
|
+
end
|
72
|
+
|
63
73
|
def get_notification_access_token(client_id:, client_secret:, **options)
|
64
74
|
orcid_api_url = options[:sandbox] ? 'https://api.sandbox.orcid.org' : 'https://api.orcid.org'
|
65
75
|
|
data/lib/orcid_client/version.rb
CHANGED
data/spec/api_spec.rb
CHANGED
@@ -74,6 +74,8 @@ describe OrcidClient, vcr: true do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "external_identifier", :order => :defined do
|
77
|
+
subject { OrcidClient::ExternalIdentifier.new(type: "GitHub", value: "mfenner", url: "https://github.com/mfenner", orcid: orcid, access_token: access_token, put_code: "3316") }
|
78
|
+
|
77
79
|
describe 'post' do
|
78
80
|
subject { OrcidClient::ExternalIdentifier.new(type: "GitHub", value: "mfenner", url: "https://github.com/mfenner", orcid: orcid, access_token: access_token) }
|
79
81
|
|
@@ -89,6 +91,21 @@ describe OrcidClient, vcr: true do
|
|
89
91
|
expect(response.body).to eq("errors"=>[{"title"=>"Access token missing"}])
|
90
92
|
end
|
91
93
|
end
|
94
|
+
|
95
|
+
describe 'delete' do
|
96
|
+
it 'should delete external_identifier' do
|
97
|
+
response = subject.delete_external_identifier(sandbox: true)
|
98
|
+
expect(response.body["data"]).to be_blank
|
99
|
+
expect(response.body["errors"]).to be_nil
|
100
|
+
expect(response.status).to eq(204)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'access_token missing' do
|
104
|
+
subject = OrcidClient::ExternalIdentifier.new(type: "GitHub", value: "mfenner", url: "https://github.com/mfenner", orcid: orcid, access_token: nil)
|
105
|
+
response = subject.delete_external_identifier(sandbox: true)
|
106
|
+
expect(response.body).to eq("errors"=>[{"title"=>"Access token missing"}])
|
107
|
+
end
|
108
|
+
end
|
92
109
|
end
|
93
110
|
|
94
111
|
describe "notifications", :order => :defined do
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: https://api.sandbox.orcid.org/v2.0_rc3/0000-0001-6528-2027/external-identifiers/3316
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Maremma - https://github.com/datacite/maremma
|
12
|
+
Content-Type:
|
13
|
+
- application/vnd.orcid+xml
|
14
|
+
Accept:
|
15
|
+
- text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
|
16
|
+
Authorization:
|
17
|
+
- Bearer <ACCESS_TOKEN>
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 204
|
21
|
+
message: ''
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- nginx/1.4.6 (Ubuntu)
|
25
|
+
Date:
|
26
|
+
- Sun, 27 Nov 2016 09:57:07 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/vnd.orcid+xml; qs=5;charset=UTF-8
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
http_version:
|
37
|
+
recorded_at: Sun, 27 Nov 2016 09:57:07 GMT
|
38
|
+
recorded_with: VCR 3.0.3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orcid_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
@@ -345,6 +345,7 @@ files:
|
|
345
345
|
- spec/api_spec.rb
|
346
346
|
- spec/external_identifier_spec.rb
|
347
347
|
- spec/fixtures/external_identifier.xml
|
348
|
+
- spec/fixtures/vcr_cassettes/OrcidClient/external_identifier/delete/should_delete_external_identifier.yml
|
348
349
|
- spec/fixtures/vcr_cassettes/OrcidClient/external_identifier/post/should_create_external_identifier.yml
|
349
350
|
- spec/fixtures/vcr_cassettes/OrcidClient/notifications/delete/should_delete_notification.yml
|
350
351
|
- spec/fixtures/vcr_cassettes/OrcidClient/notifications/get/should_get_notification.yml
|