orcid_client 0.3.1 → 0.3.2

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: b5b365dd7c26ee99fbdc0a3117085a6f2babfcc6
4
- data.tar.gz: 41ed338d9a137b7873d9d46f149181066042964b
3
+ metadata.gz: 6960e17659f33b9322efd4245e280f0ed238373c
4
+ data.tar.gz: e234021d37507f3127dae5ce54b17fca92213af3
5
5
  SHA512:
6
- metadata.gz: 7e3a7f5aed89fabab37fe927f8e3d7862ed9860d4ed0717882d42791db1132614c2b6e17e7ba2067e07ecb96d43b9ecf45748901cae187700e8de8ae8bbd01c8
7
- data.tar.gz: f4443f97b4da1cfe8f4b170fbf82023c92f5b49c15ef049485de9c8bee71996be05fd56bf99e0621e3a5d14f2029223db3586dadc9deef8f7a421ca4d18e685b
6
+ metadata.gz: 463f90ad15582778fa5943aba6b505cca229d5b5f788f13995738f7d98d247a30bc8eb94cbf1c5617488c11257bf45e00bb132c6e4a9f75647b9646da73bc9d6
7
+ data.tar.gz: a87f5baeb14a4169f4e122f12daeb818730a254511808a70230d3bcca4e2deb80193dbb00a7f102d82dd332801de8c8fff7017e993c0d3764ccbe001833b174d
data/.env.example CHANGED
@@ -1,4 +1,5 @@
1
1
  ORCID_API_URL=
2
+ SEARCH_URL=
2
3
 
3
4
  # needed to post works
4
5
  ACCESS_TOKEN=
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orcid_client (0.3.1)
4
+ orcid_client (0.3.2)
5
5
  activesupport (>= 4.2.5, < 6)
6
- bolognese (~> 0.9.26)
6
+ bolognese (~> 0.9.28)
7
7
  builder (~> 3.2, >= 3.2.2)
8
8
  dotenv (~> 2.1, >= 2.1.1)
9
9
  maremma (~> 3.5, >= 3.5.7)
@@ -23,7 +23,7 @@ GEM
23
23
  benchmark_methods (0.7)
24
24
  bibtex-ruby (4.4.3)
25
25
  latex-decode (~> 0.0)
26
- bolognese (0.9.26)
26
+ bolognese (0.9.28)
27
27
  activesupport (>= 4.2.5, < 6)
28
28
  benchmark_methods (~> 0.7)
29
29
  bibtex-ruby (~> 4.1)
@@ -129,7 +129,7 @@ GEM
129
129
  rdf-turtle (2.2.0)
130
130
  ebnf (~> 1.1)
131
131
  rdf (~> 2.2)
132
- rdf-xsd (2.1.0)
132
+ rdf-xsd (2.2.0)
133
133
  rdf (~> 2.1)
134
134
  rspec (3.6.0)
135
135
  rspec-core (~> 3.6.0)
@@ -17,5 +17,6 @@ module OrcidClient
17
17
 
18
18
  # default values for some ENV variables
19
19
  ENV['ORCID_API_URL'] ||= "https://api.sandbox.orcid.org"
20
+ ENV['SEARCH_URL'] ||= "https://search.datacite.org/api"
20
21
  end
21
22
  end
@@ -1,3 +1,3 @@
1
1
  module OrcidClient
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -17,12 +17,13 @@ module OrcidClient
17
17
 
18
18
  include Bolognese::Utils
19
19
 
20
- attr_reader :doi, :orcid, :schema, :access_token, :put_code, :validation_errors, :name_detector
20
+ attr_reader :doi, :orcid, :schema, :access_token, :search_url, :put_code, :validation_errors, :name_detector
21
21
 
22
22
  def initialize(doi:, orcid:, access_token:, **options)
23
23
  @doi = doi
24
24
  @orcid = orcid
25
25
  @access_token = access_token
26
+ @search_url = options.fetch(:search_url, nil) || ENV['SEARCH_URL']
26
27
  @put_code = options.fetch(:put_code, nil)
27
28
  end
28
29
 
@@ -33,7 +34,7 @@ module OrcidClient
33
34
  end
34
35
 
35
36
  def metadata
36
- @metadata ||= Bolognese::Metadata.new(input: doi)
37
+ @metadata ||= Bolognese::Metadata.new(input: doi, search_url: search_url)
37
38
  end
38
39
 
39
40
  def contributors
data/orcid_client.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
 
21
21
  # Declary dependencies here, rather than in the Gemfile
22
22
  s.add_dependency 'maremma', '~> 3.5', '>= 3.5.7'
23
- s.add_dependency 'bolognese', '~> 0.9.26'
23
+ s.add_dependency 'bolognese', '~> 0.9.28'
24
24
  s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
25
25
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
26
26
  s.add_dependency 'namae', '~> 0.11.3'
@@ -0,0 +1,107 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datacite.org/prefixes/10.5286
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: OK
18
+ headers:
19
+ Access-Control-Allow-Headers:
20
+ - Content-Type,Accept,Accept-Encoding,Origin,User-Agent,Cache-Control,Keep-Alive
21
+ Access-Control-Allow-Methods:
22
+ - GET, POST, OPTIONS
23
+ Access-Control-Allow-Origin:
24
+ - "*"
25
+ Access-Control-Max-Age:
26
+ - '1728000'
27
+ Cache-Control:
28
+ - max-age=0, private, must-revalidate
29
+ Content-Type:
30
+ - application/vnd.api+json; charset=utf-8
31
+ Date:
32
+ - Sun, 25 Jun 2017 13:10:31 GMT
33
+ Etag:
34
+ - W/"be181a297e99f2daa28e8ee93e167f12"
35
+ Server:
36
+ - openresty/1.11.2.2
37
+ Status:
38
+ - 200 OK
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - kong/0.10.3
43
+ X-Content-Type-Options:
44
+ - nosniff
45
+ X-Frame-Options:
46
+ - SAMEORIGIN
47
+ X-Kong-Proxy-Latency:
48
+ - '0'
49
+ X-Kong-Upstream-Latency:
50
+ - '553'
51
+ X-Powered-By:
52
+ - Phusion Passenger 5.1.5
53
+ X-Ratelimit-Limit-Hour:
54
+ - '100000'
55
+ X-Ratelimit-Remaining-Hour:
56
+ - '99998'
57
+ X-Request-Id:
58
+ - 4f0d3a43-38e0-46ac-9106-b363d0837ef3
59
+ X-Runtime:
60
+ - '0.550820'
61
+ X-Xss-Protection:
62
+ - 1; mode=block
63
+ Content-Length:
64
+ - '124'
65
+ Connection:
66
+ - keep-alive
67
+ body:
68
+ encoding: UTF-8
69
+ string: '{"data":{"id":"10.5286","type":"prefixes","attributes":{"registration-agency":"DataCite","updated":"2016-09-21T20:27:14Z"}}}'
70
+ http_version:
71
+ recorded_at: Sun, 25 Jun 2017 13:10:31 GMT
72
+ - request:
73
+ method: get
74
+ uri: https://search.test.datacite.org/api?fl=doi,xml,media,minted,updated&q=doi:10.5286/topcat/isis/1/datacollection/84974338&wt=json
75
+ body:
76
+ encoding: US-ASCII
77
+ string: ''
78
+ headers:
79
+ User-Agent:
80
+ - Maremma - https://github.com/datacite/maremma
81
+ Accept:
82
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
83
+ response:
84
+ status:
85
+ code: 200
86
+ message: OK
87
+ headers:
88
+ Access-Control-Allow-Methods:
89
+ - GET, POST, OPTIONS
90
+ Access-Control-Allow-Origin:
91
+ - "*"
92
+ Content-Type:
93
+ - application/json;charset=UTF-8
94
+ Date:
95
+ - Sun, 25 Jun 2017 13:10:31 GMT
96
+ Server:
97
+ - openresty/1.11.2.2
98
+ Connection:
99
+ - keep-alive
100
+ body:
101
+ encoding: UTF-8
102
+ string: '{"responseHeader":{"status":0,"QTime":1},"response":{"numFound":1,"start":0,"docs":[{"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHJlc291cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtNCIgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRwOi8vZ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klTSVM8L3B1Ymxpc2hlcj48cHVibGljYXRpb25ZZWFyPjIwMTc8L3B1YmxpY2F0aW9uWWVhcj48cmVzb3VyY2VUeXBlIHJlc291cmNlVHlwZUdlbmVyYWw9IkRhdGFzZXQiPkV4cGVyaW1lbnQgRGF0YTwvcmVzb3VyY2VUeXBlPjxyaWdodHNMaXN0PjxyaWdodHMgcmlnaHRzVVJJPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9saWNlbnNlcy9ieS80LjAvIj5DcmVhdGl2ZSBDb21tb25zIC0gQXR0cmlidXRpb24gNC4wIEludGVybmF0aW9uYWw8L3JpZ2h0cz48L3JpZ2h0c0xpc3Q+PC9yZXNvdXJjZT4=","minted":"2017-06-23T14:30:35Z","updated":"2017-06-23T14:30:35Z","doi":"10.5286/TOPCAT/ISIS/1/DATACOLLECTION/84974338"}]}}
103
+
104
+ '
105
+ http_version:
106
+ recorded_at: Sun, 25 Jun 2017 13:10:31 GMT
107
+ recorded_with: VCR 3.0.3
data/spec/work_spec.rb CHANGED
@@ -29,6 +29,13 @@ describe OrcidClient::Work, vcr: true do
29
29
  expect(subject.validation_errors).to be_empty
30
30
  end
31
31
 
32
+ it 'validates work from DataCite test system' do
33
+ search_url = "https://search.test.datacite.org/api"
34
+ subject = OrcidClient::Work.new(doi: "10.5286/TOPCAT/ISIS/1/DATACOLLECTION/84974338", orcid: "0000-0003-1613-5981", access_token: access_token, search_url: search_url)
35
+ expect(subject.type).to eq("data-set")
36
+ expect(subject.validation_errors).to be_empty
37
+ end
38
+
32
39
  it 'validates ORCID IDs for contributors' do
33
40
  subject = OrcidClient::Work.new(doi: "10.2314/COSCV1", orcid: "0000-0001-6528-2027", access_token: access_token)
34
41
  expect(subject.validation_errors).to be_empty
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orcid_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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-06-20 00:00:00.000000000 Z
11
+ date: 2017-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 0.9.26
39
+ version: 0.9.28
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.9.26
46
+ version: 0.9.28
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -389,6 +389,7 @@ files:
389
389
  - spec/fixtures/vcr_cassettes/OrcidClient_Work/publication_date.yml
390
390
  - spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_ORCID_IDs_for_contributors.yml
391
391
  - spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_data.yml
392
+ - spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_work_from_DataCite_test_system.yml
392
393
  - spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_work_type_data-set.yml
393
394
  - spec/fixtures/work.xml
394
395
  - spec/notification_spec.rb