orcid_client 0.2.3 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +120 -43
  3. data/lib/orcid_client/api.rb +1 -1
  4. data/lib/orcid_client/author.rb +2 -49
  5. data/lib/orcid_client/date.rb +3 -3
  6. data/lib/orcid_client/external_identifier.rb +1 -1
  7. data/lib/orcid_client/notification.rb +3 -5
  8. data/lib/orcid_client/version.rb +1 -1
  9. data/lib/orcid_client/work.rb +23 -28
  10. data/lib/orcid_client.rb +2 -0
  11. data/orcid_client.gemspec +5 -4
  12. data/resources/{common_2.0_rc3/common-2.0_rc3.xsd → common_2.0/common-2.0.xsd} +68 -49
  13. data/resources/{common_2.0_rc3/samples/common-2.0_rc3.xml → common_2.0/samples/common-2.0.xml} +1 -1
  14. data/resources/notification_2.0/README.md +123 -0
  15. data/resources/notification_2.0/notification-custom-2.0.xsd +38 -0
  16. data/resources/notification_2.0/notification-permission-2.0.xsd +134 -0
  17. data/resources/{notification_2.0_rc3/samples/notification-custom-2.0_rc3.xml → notification_2.0/samples/notification-custom-2.0.xml} +3 -3
  18. data/resources/{notification_2.0_rc3/samples/notification-permission-2.0_rc3.xml → notification_2.0/samples/notification-permission-2.0.xml} +2 -2
  19. data/resources/record_2.0/README.md +304 -0
  20. data/resources/{record_2.0_rc3/activities-2.0_rc3.xsd → record_2.0/activities-2.0.xsd} +79 -46
  21. data/resources/{record_2.0_rc3/address-2.0_rc3.xsd → record_2.0/address-2.0.xsd} +1 -1
  22. data/resources/{record_2.0_rc3/bulk-2.0_rc3.xsd → record_2.0/bulk-2.0.xsd} +12 -12
  23. data/resources/{record_2.0_rc3/education-2.0_rc3.xsd → record_2.0/education-2.0.xsd} +5 -5
  24. data/resources/{record_2.0_rc3/email-2.0_rc3.xsd → record_2.0/email-2.0.xsd} +3 -1
  25. data/resources/{record_2.0_rc3/employment-2.0_rc3.xsd → record_2.0/employment-2.0.xsd} +5 -5
  26. data/resources/{record_2.0_rc3/error-2.0_rc3.xsd → record_2.0/error-2.0.xsd} +0 -0
  27. data/resources/{record_2.0_rc3/funding-2.0_rc3.xsd → record_2.0/funding-2.0.xsd} +5 -49
  28. data/resources/{record_2.0_rc3/history-2.0_rc3.xsd → record_2.0/history-2.0.xsd} +1 -1
  29. data/resources/{record_2.0_rc3/keyword-2.0_rc3.xsd → record_2.0/keyword-2.0.xsd} +2 -2
  30. data/resources/{record_2.0_rc3/other-name-2.0_rc3.xsd → record_2.0/other-name-2.0.xsd} +2 -2
  31. data/resources/{record_2.0_rc3/peer-review-2.0_rc3.xsd → record_2.0/peer-review-2.0.xsd} +4 -4
  32. data/resources/record_2.0/peer-review-guide-v2.0.md +131 -0
  33. data/resources/{record_2.0_rc3/person-2.0_rc3.xsd → record_2.0/person-2.0.xsd} +8 -21
  34. data/resources/{record_2.0_rc3/person-external-identifier-2.0_rc3.xsd → record_2.0/person-external-identifier-2.0.xsd} +1 -1
  35. data/resources/{record_2.0_rc3/personal-details-2.0_rc3.xsd → record_2.0/personal-details-2.0.xsd} +5 -7
  36. data/resources/{record_2.0_rc3/preferences-2.0_rc3.xsd → record_2.0/preferences-2.0.xsd} +1 -1
  37. data/resources/{record_2.0_rc3/record-2.0_rc3.xsd → record_2.0/record-2.0.xsd} +16 -23
  38. data/resources/{record_2.0_rc3/researcher-url-2.0_rc3.xsd → record_2.0/researcher-url-2.0.xsd} +2 -2
  39. data/resources/{record_2.0_rc3/samples/activities-2.0_rc3.xml → record_2.0/samples/read_samples/activities-2.0.xml} +24 -12
  40. data/resources/{record_2.0_rc3/samples/address-2.0_rc3.xml → record_2.0/samples/read_samples/address-2.0.xml} +1 -1
  41. data/resources/{record_2.0_rc3/samples/addresses-2.0_rc3.xml → record_2.0/samples/read_samples/addresses-2.0.xml} +1 -1
  42. data/resources/{record_2.0_rc3/samples/biography-2.0_rc3.xml → record_2.0/samples/read_samples/biography-2.0.xml} +2 -2
  43. data/resources/record_2.0/samples/read_samples/bulk-work-error.xml +45 -0
  44. data/resources/{record_2.0_rc3/samples/credit-name-2.0_rc3.xml → record_2.0/samples/read_samples/credit-name-2.0.xml} +2 -2
  45. data/resources/{record_2.0_rc3/samples/education-full-2.0_rc3.xml → record_2.0/samples/read_samples/education-2.0.xml} +1 -1
  46. data/resources/{record_2.0_rc3/samples/education-2.0_rc3.xml → record_2.0/samples/read_samples/education-full-2.0.xml} +12 -2
  47. data/resources/record_2.0/samples/read_samples/educations-2.0.xml +52 -0
  48. data/resources/{record_2.0_rc3/samples/email-2.0_rc3.xml → record_2.0/samples/read_samples/email-2.0.xml} +2 -2
  49. data/resources/{record_2.0_rc3/samples/emails-2.0_rc3.xml → record_2.0/samples/read_samples/emails-2.0.xml} +3 -3
  50. data/resources/{record_2.0_rc3/samples/employment-full-2.0_rc3.xml → record_2.0/samples/read_samples/employment-2.0.xml} +1 -1
  51. data/resources/{record_2.0_rc3/samples/employment-2.0_rc3.xml → record_2.0/samples/read_samples/employment-full-2.0.xml} +14 -4
  52. data/resources/record_2.0/samples/read_samples/employments-2.0.xml +52 -0
  53. data/resources/{record_2.0_rc3/samples/error-2.0_rc3.xml → record_2.0/samples/read_samples/error-2.0.xml} +1 -1
  54. data/resources/{record_2.0_rc3/samples/external-identifier-2.0_rc3.xml → record_2.0/samples/read_samples/external-identifier-2.0.xml} +3 -2
  55. data/resources/{record_2.0_rc3/samples/external-identifiers-2.0_rc3.xml → record_2.0/samples/read_samples/external-identifiers-2.0.xml} +5 -3
  56. data/resources/{record_2.0_rc3/samples/funding-full-2.0_rc3.xml → record_2.0/samples/read_samples/funding-2.0.xml} +2 -2
  57. data/resources/{record_2.0_rc3/samples/funding-2.0_rc3.xml → record_2.0/samples/read_samples/funding-full-2.0.xml} +13 -3
  58. data/resources/record_2.0/samples/read_samples/fundings-2.0.xml +138 -0
  59. data/resources/{record_2.0_rc3/samples/history-2.0_rc3.xml → record_2.0/samples/read_samples/history-2.0.xml} +1 -1
  60. data/resources/{record_2.0_rc3/samples/keyword-2.0_rc3.xml → record_2.0/samples/read_samples/keyword-2.0.xml} +1 -1
  61. data/resources/{record_2.0_rc3/samples/keywords-2.0_rc3.xml → record_2.0/samples/read_samples/keywords-2.0.xml} +1 -1
  62. data/resources/{record_2.0_rc3/samples/name-2.0_rc3.xml → record_2.0/samples/read_samples/name-2.0.xml} +1 -1
  63. data/resources/{record_2.0_rc3/samples/other-name-2.0_rc3.xml → record_2.0/samples/read_samples/other-name-2.0.xml} +1 -1
  64. data/resources/{record_2.0_rc3/samples/other-names-2.0_rc3.xml → record_2.0/samples/read_samples/other-names-2.0.xml} +1 -1
  65. data/resources/{record_2.0_rc3/samples/peer-review-full-2.0_rc3.xml → record_2.0/samples/read_samples/peer-review-2.0.xml} +1 -1
  66. data/resources/{record_2.0_rc3/samples/peer-review-2.0_rc3.xml → record_2.0/samples/read_samples/peer-review-full-2.0.xml} +18 -8
  67. data/resources/record_2.0/samples/read_samples/peer-reviews-2.0.xml +73 -0
  68. data/resources/{record_2.0_rc3/samples/person-2.0_rc3.xml → record_2.0/samples/read_samples/person-2.0.xml} +1 -1
  69. data/resources/{record_2.0_rc3/samples/personal-details-2.0_rc3.xml → record_2.0/samples/read_samples/personal-details-2.0.xml} +1 -1
  70. data/resources/{record_2.0_rc3/samples/preferences-2.0_rc3.xml → record_2.0/samples/read_samples/preferences-2.0.xml} +1 -1
  71. data/resources/{record_2.0_rc3/samples/record-2.0_rc3.xml → record_2.0/samples/read_samples/record-2.0.xml} +73 -85
  72. data/resources/{record_2.0_rc3/samples/researcher-url-2.0_rc3.xml → record_2.0/samples/read_samples/researcher-url-2.0.xml} +1 -1
  73. data/resources/{record_2.0_rc3/samples/researcher-urls-2.0_rc3.xml → record_2.0/samples/read_samples/researcher-urls-2.0.xml} +1 -1
  74. data/resources/record_2.0/samples/read_samples/search-2.0.xml +14 -0
  75. data/resources/{record_2.0_rc3/samples/work-full-2.0_rc3.xml → record_2.0/samples/read_samples/work-2.0.xml} +5 -5
  76. data/resources/{record_2.0_rc3/samples/work-2.0_rc3.xml → record_2.0/samples/read_samples/work-full-2.0.xml} +14 -4
  77. data/resources/record_2.0/samples/read_samples/works-2.0.xml +146 -0
  78. data/resources/record_2.0/samples/write_sample/address-2.0.xml +6 -0
  79. data/resources/{record_2.0_rc3/samples/bulk-work-2.0_rc3.json → record_2.0/samples/write_sample/bulk-work-2.0.json} +55 -55
  80. data/resources/{record_2.0_rc3/samples/bulk-work-2.0_rc3.xml → record_2.0/samples/write_sample/bulk-work-2.0.xml} +18 -11
  81. data/resources/record_2.0/samples/write_sample/education-2.0.xml +30 -0
  82. data/resources/record_2.0/samples/write_sample/employment-2.0.xml +30 -0
  83. data/resources/record_2.0/samples/write_sample/external-identifier-2.0.xml +11 -0
  84. data/resources/record_2.0/samples/write_sample/funding-2.0.xml +44 -0
  85. data/resources/record_2.0/samples/write_sample/keyword-2.0.xml +7 -0
  86. data/resources/record_2.0/samples/write_sample/other-name-2.0.xml +6 -0
  87. data/resources/record_2.0/samples/write_sample/peer-review-full-2.0.xml +48 -0
  88. data/resources/record_2.0/samples/write_sample/peer-review-simple-2.0.xml +32 -0
  89. data/resources/record_2.0/samples/write_sample/researcher-url-2.0.xml +7 -0
  90. data/resources/record_2.0/samples/write_sample/work-full-2.0.xml +54 -0
  91. data/resources/record_2.0/samples/write_sample/work-simple-2.0.xml +18 -0
  92. data/resources/{record_2.0_rc3/search-2.0_rc3.xsd → record_2.0/search-2.0.xsd} +6 -26
  93. data/resources/{record_2.0_rc3/work-2.0_rc3.xsd → record_2.0/work-2.0.xsd} +8 -129
  94. data/spec/api_spec.rb +3 -3
  95. data/spec/external_identifier_spec.rb +2 -2
  96. data/spec/fixtures/external_identifier.xml +1 -1
  97. data/spec/fixtures/vcr_cassettes/OrcidClient/external_identifier/delete/should_delete_external_identifier.yml +17 -5
  98. data/spec/fixtures/vcr_cassettes/OrcidClient/external_identifier/post/should_create_external_identifier.yml +19 -7
  99. data/spec/fixtures/vcr_cassettes/OrcidClient/notifications/delete/should_delete_notification.yml +19 -6
  100. data/spec/fixtures/vcr_cassettes/OrcidClient/notifications/get/should_get_notification.yml +20 -6
  101. data/spec/fixtures/vcr_cassettes/OrcidClient/notifications/post/should_create_notification.yml +90 -25
  102. data/spec/fixtures/vcr_cassettes/OrcidClient/works/delete/should_delete_work.yml +17 -5
  103. data/spec/fixtures/vcr_cassettes/OrcidClient/works/get/should_get_works.yml +554 -543
  104. data/spec/fixtures/vcr_cassettes/OrcidClient/works/post/should_create_work.yml +90 -25
  105. data/spec/fixtures/vcr_cassettes/OrcidClient/works/put/should_update_work.yml +99 -28
  106. data/spec/fixtures/vcr_cassettes/OrcidClient_Notification/data.yml +72 -17
  107. data/spec/fixtures/vcr_cassettes/OrcidClient_Notification/schema/validates_data.yml +70 -17
  108. data/spec/fixtures/vcr_cassettes/OrcidClient_Notification/schema/validates_item_type_work.yml +72 -14
  109. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/contributors/literal.yml +72 -20
  110. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/contributors/multiple_titles.yml +72 -20
  111. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/contributors/valid.yml +72 -23
  112. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/contributors/with_ORCID_IDs.yml +75 -133
  113. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/data.yml +72 -23
  114. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/publication_date.yml +72 -23
  115. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_ORCID_IDs_for_contributors.yml +75 -133
  116. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_data.yml +72 -23
  117. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/schema/validates_work_type_data-set.yml +72 -20
  118. data/spec/fixtures/work.xml +4 -2
  119. data/spec/notification_spec.rb +4 -4
  120. data/spec/work_spec.rb +6 -6
  121. metadata +122 -80
  122. data/lib/orcid_client/metadata.rb +0 -128
  123. data/resources/notification_2.0_rc3/notification-custom-2.0_rc3.xsd +0 -32
  124. data/resources/notification_2.0_rc3/notification-permission-2.0_rc3.xsd +0 -128
  125. data/resources/record_2.0_rc3/deprecated-2.0_rc3.xsd +0 -80
  126. data/resources/record_2.0_rc3/internal-2.0_rc3.xsd +0 -199
  127. data/resources/record_2.0_rc3/samples/deprecated-2.0_rc3.xml +0 -13
  128. data/resources/record_2.0_rc3/samples/search-2.0_rc3.xml +0 -368
  129. data/spec/fixtures/vcr_cassettes/OrcidClient_Work/citation.yml +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeaf7b53eebf7c7877d24e9fc458a7a6a307032d
4
- data.tar.gz: 65e9b253be1606b55d93d8eabddf834a2a10ef7a
3
+ metadata.gz: 4409ba94da970aeb5d0ed1eb13bf77b97b7c697d
4
+ data.tar.gz: ff0317e8fbdba576f41a127af792336be090fd5d
5
5
  SHA512:
6
- metadata.gz: 996e7dcb216b8568c2823c7fdbd11abcc84bba831b46e34e0040b79f38d923f0f921a2313c6f478abdfda8f3c533b34d869766482d9b225cfd8a36edce31b80c
7
- data.tar.gz: 87d4e73f8a67f2a670f5d9b4d1757480c2a1a8a2236b29636c7e3cf62f39b1c57cf03779c38728d4640ff5803bf6940875e9a947e79d780e5d15b35ffe1e6abb
6
+ metadata.gz: 8e3c17393883843786e75e5531e3f93959294d7c12aa9d1762514076f2f45c6576b19337411101c4d50f4bf770c009af591fe9063c417db3c6f31321d0a6e28a
7
+ data.tar.gz: 8e0ad8d7273a78a3e0c81032740a6d9700a9e6ffe45949183296780ba1c9595b82b9761103aa9bf0306779040245d2c5f62f0622f168b86b7c6392094144193d
data/Gemfile.lock CHANGED
@@ -1,35 +1,60 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orcid_client (0.2.3)
5
- activesupport (~> 4.2, >= 4.2.5)
4
+ orcid_client (0.3)
5
+ activesupport (>= 4.2.5, < 6)
6
+ bolognese (~> 0.9.26)
6
7
  builder (~> 3.2, >= 3.2.2)
7
8
  dotenv (~> 2.1, >= 2.1.1)
8
- maremma (~> 3.0)
9
+ maremma (~> 3.5, >= 3.5.7)
9
10
  namae (~> 0.11.3)
10
- nokogiri (~> 1.6.8)
11
+ nokogiri (~> 1.6, >= 1.6.8)
11
12
  sanitize (~> 4.0, >= 4.0.1)
12
13
 
13
14
  GEM
14
15
  remote: https://rubygems.org/
15
16
  specs:
16
- activesupport (4.2.7.1)
17
+ activesupport (5.1.1)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
19
  i18n (~> 0.7)
18
- json (~> 1.7, >= 1.7.7)
19
20
  minitest (~> 5.1)
20
- thread_safe (~> 0.3, >= 0.3.4)
21
21
  tzinfo (~> 1.1)
22
- addressable (2.5.0)
22
+ addressable (2.5.1)
23
23
  public_suffix (~> 2.0, >= 2.0.2)
24
+ benchmark_methods (0.7)
25
+ bibtex-ruby (4.4.3)
26
+ latex-decode (~> 0.0)
27
+ bolognese (0.9.26)
28
+ activesupport (>= 4.2.5, < 6)
29
+ benchmark_methods (~> 0.7)
30
+ bibtex-ruby (~> 4.1)
31
+ builder (~> 3.2, >= 3.2.2)
32
+ colorize (~> 0.8.1)
33
+ gender_detector (~> 0.1.2)
34
+ json-ld (~> 2.1, >= 2.1.2)
35
+ jsonlint (~> 0.2.0)
36
+ loofah (~> 2.0, >= 2.0.3)
37
+ maremma (~> 3.5, >= 3.5.7)
38
+ namae (~> 0.11.3)
39
+ nokogiri (~> 1.6, >= 1.6.8)
40
+ postrank-uri (~> 1.0, >= 1.0.18)
41
+ rdf-rdfxml (~> 2.0)
42
+ rdf-turtle (~> 2.2)
43
+ thor (~> 0.19)
24
44
  builder (3.2.3)
25
- codeclimate-test-reporter (1.0.5)
26
- simplecov
45
+ codeclimate-test-reporter (1.0.8)
46
+ simplecov (<= 0.13)
47
+ colorize (0.8.1)
48
+ concurrent-ruby (1.0.5)
27
49
  crack (0.4.3)
28
50
  safe_yaml (~> 1.0.0)
29
51
  crass (1.0.2)
30
52
  diff-lcs (1.3)
31
53
  docile (1.1.5)
32
- dotenv (2.2.0)
54
+ dotenv (2.2.1)
55
+ ebnf (1.1.0)
56
+ rdf (~> 2.0)
57
+ sxp (~> 1.0)
33
58
  excon (0.45.4)
34
59
  faraday (0.9.2)
35
60
  multipart-post (>= 1.2, < 3)
@@ -37,50 +62,94 @@ GEM
37
62
  faraday
38
63
  faraday_middleware (0.10.1)
39
64
  faraday (>= 0.7.4, < 1.0)
40
- hashdiff (0.3.2)
41
- i18n (0.8.0)
42
- json (1.8.6)
43
- maremma (3.1.2)
44
- activesupport (~> 4.2, >= 4.2.5)
45
- addressable (~> 2.5)
65
+ gender_detector (0.1.2)
66
+ unicode_utils (>= 1.3.0)
67
+ haml (5.0.1)
68
+ temple (>= 0.8.0)
69
+ tilt
70
+ hamster (3.0.0)
71
+ concurrent-ruby (~> 1.0)
72
+ hashdiff (0.3.4)
73
+ htmlentities (4.3.4)
74
+ i18n (0.8.4)
75
+ json (2.1.0)
76
+ json-ld (2.1.4)
77
+ multi_json (~> 1.12)
78
+ rdf (~> 2.2)
79
+ jsonlint (0.2.0)
80
+ oj (~> 2)
81
+ trollop (~> 2)
82
+ latex-decode (0.2.2)
83
+ unicode (~> 0.4)
84
+ link_header (0.0.8)
85
+ loofah (2.0.3)
86
+ nokogiri (>= 1.5.9)
87
+ maremma (3.5.8)
88
+ activesupport (>= 4.2.5)
89
+ addressable (>= 2.3.6)
46
90
  builder (~> 3.2, >= 3.2.2)
47
91
  excon (~> 0.45.0)
48
92
  faraday (~> 0.9.2)
49
93
  faraday-encoding (~> 0.0.1)
50
94
  faraday_middleware (~> 0.10.0)
51
- multi_json (~> 1.11.2)
52
- nokogiri (~> 1.6.7)
53
- oj (~> 2.13.1)
95
+ multi_json (~> 1.12)
96
+ nokogiri (~> 1.6, >= 1.6.8)
97
+ oj (~> 2.18, >= 2.18.1)
54
98
  mini_portile2 (2.1.0)
55
- minitest (5.10.1)
56
- multi_json (1.11.3)
99
+ minitest (5.10.2)
100
+ multi_json (1.12.1)
57
101
  multipart-post (2.0.0)
58
102
  namae (0.11.3)
59
- nokogiri (1.6.8.1)
103
+ nokogiri (1.7.2)
60
104
  mini_portile2 (~> 2.1.0)
61
- nokogumbo (1.4.10)
105
+ nokogumbo (1.4.13)
62
106
  nokogiri
63
- oj (2.13.1)
107
+ oj (2.18.5)
108
+ postrank-uri (1.0.22)
109
+ addressable (>= 2.3.0, < 2.6)
110
+ nokogiri (>= 1.6.1, < 1.8)
111
+ public_suffix (>= 2.0.0, < 2.1)
64
112
  public_suffix (2.0.5)
65
- rack (2.0.1)
113
+ rack (2.0.3)
66
114
  rack-test (0.6.3)
67
115
  rack (>= 1.0)
68
116
  rake (12.0.0)
69
- rspec (3.5.0)
70
- rspec-core (~> 3.5.0)
71
- rspec-expectations (~> 3.5.0)
72
- rspec-mocks (~> 3.5.0)
73
- rspec-core (3.5.4)
74
- rspec-support (~> 3.5.0)
75
- rspec-expectations (3.5.0)
117
+ rdf (2.2.6)
118
+ hamster (~> 3.0)
119
+ link_header (~> 0.0, >= 0.0.8)
120
+ rdf-aggregate-repo (2.2.0)
121
+ rdf (~> 2.0)
122
+ rdf-rdfa (2.2.2)
123
+ haml (~> 5.0)
124
+ htmlentities (~> 4.3)
125
+ rdf (~> 2.2)
126
+ rdf-aggregate-repo (~> 2.2)
127
+ rdf-xsd (~> 2.1)
128
+ rdf-rdfxml (2.0.0)
129
+ htmlentities (~> 4.3)
130
+ rdf (~> 2.0)
131
+ rdf-rdfa (~> 2.0)
132
+ rdf-xsd (~> 2.0)
133
+ rdf-turtle (2.2.0)
134
+ ebnf (~> 1.1)
135
+ rdf (~> 2.2)
136
+ rdf-xsd (2.1.0)
137
+ rdf (~> 2.1)
138
+ rspec (3.6.0)
139
+ rspec-core (~> 3.6.0)
140
+ rspec-expectations (~> 3.6.0)
141
+ rspec-mocks (~> 3.6.0)
142
+ rspec-core (3.6.0)
143
+ rspec-support (~> 3.6.0)
144
+ rspec-expectations (3.6.0)
76
145
  diff-lcs (>= 1.2.0, < 2.0)
77
- rspec-support (~> 3.5.0)
78
- rspec-mocks (3.5.0)
146
+ rspec-support (~> 3.6.0)
147
+ rspec-mocks (3.6.0)
79
148
  diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.5.0)
81
- rspec-support (3.5.0)
149
+ rspec-support (~> 3.6.0)
150
+ rspec-support (3.6.0)
82
151
  safe_yaml (1.0.4)
83
- sanitize (4.4.0)
152
+ sanitize (4.5.0)
84
153
  crass (~> 1.0.2)
85
154
  nokogiri (>= 1.4.4)
86
155
  nokogumbo (~> 1.4.1)
@@ -88,12 +157,20 @@ GEM
88
157
  docile (~> 1.1.0)
89
158
  json (>= 1.8, < 3)
90
159
  simplecov-html (~> 0.10.0)
91
- simplecov-html (0.10.0)
92
- thread_safe (0.3.5)
93
- tzinfo (1.2.2)
160
+ simplecov-html (0.10.1)
161
+ sxp (1.0.0)
162
+ rdf (~> 2.0)
163
+ temple (0.8.0)
164
+ thor (0.19.4)
165
+ thread_safe (0.3.6)
166
+ tilt (2.0.7)
167
+ trollop (2.1.2)
168
+ tzinfo (1.2.3)
94
169
  thread_safe (~> 0.1)
170
+ unicode (0.4.4.4)
171
+ unicode_utils (1.4.0)
95
172
  vcr (3.0.3)
96
- webmock (1.24.6)
173
+ webmock (3.0.1)
97
174
  addressable (>= 2.3.6)
98
175
  crack (>= 0.3.2)
99
176
  hashdiff
@@ -110,7 +187,7 @@ DEPENDENCIES
110
187
  rspec (~> 3.4)
111
188
  simplecov
112
189
  vcr
113
- webmock (~> 1.22, >= 1.22.3)
190
+ webmock (~> 3.0, >= 3.0.1)
114
191
 
115
192
  BUNDLED WITH
116
193
  1.12.5
@@ -2,7 +2,7 @@ require "uri"
2
2
 
3
3
  module OrcidClient
4
4
  module Api
5
- API_VERSION = "2.0_rc3"
5
+ API_VERSION = "2.0"
6
6
 
7
7
  def get_works(options={})
8
8
  return OpenStruct.new(body: { "errors" => [{ "title" => "Access token missing" }] }) unless access_token.present?
@@ -1,54 +1,7 @@
1
- require 'namae'
2
-
3
1
  module OrcidClient
4
2
  module Author
5
- def validate_orcid(orcid)
6
- orcid = Array(/\A(?:http:\/\/orcid\.org\/)?(\d{4}[[:space:]-]\d{4}[[:space:]-]\d{4}[[:space:]-]\d{3}[0-9X]+)\z/.match(orcid)).last
7
- orcid.gsub(/[[:space:]]/, "-") if orcid.present?
8
- end
9
-
10
- # parse author string into CSL format
11
- def get_one_author(author)
12
- return "" if author.blank?
13
-
14
- names = Namae.parse(author)
15
- if names.present?
16
- name = names.first
17
-
18
- { "family" => name.family,
19
- "given" => name.given }.compact
20
- else
21
- { "literal" => author }
22
- end
23
- end
24
-
25
- # parse array of author strings into CSL format
26
- def get_authors(authors)
27
- Array(authors).map { |author| get_one_author(author) }
28
- end
29
-
30
- # parse array of author hashes into CSL format
31
- def get_hashed_authors(authors)
32
- Array(authors).map { |author| get_one_hashed_author(author) }
33
- end
34
-
35
- def get_one_hashed_author(author)
36
- raw_name = author.fetch("creatorName", nil)
37
-
38
- author_hsh = get_one_author(raw_name)
39
- author_hsh["ORCID"] = get_name_identifier(author)
40
- author_hsh.compact
41
- end
42
-
43
- def get_name_identifier(author)
44
- name_identifier = author.fetch("nameIdentifier", nil)
45
- name_identifier_scheme = author.fetch("nameIdentifierScheme", "orcid").downcase
46
- if name_identifier_scheme == "orcid" && name_identifier = validate_orcid(name_identifier)
47
- "http://orcid.org/#{name_identifier}"
48
- else
49
- nil
50
- end
51
- end
3
+ include Bolognese::AuthorUtils
4
+ include Bolognese::Utils
52
5
 
53
6
  def get_credit_name(author)
54
7
  [author['given'], author['family']].compact.join(' ').presence || author['literal']
@@ -38,9 +38,9 @@ module OrcidClient
38
38
  month = iso8601_time[5..6]
39
39
  day = iso8601_time[8..9]
40
40
 
41
- { 'year' => year.to_i,
42
- 'month' => month.to_i,
43
- 'day' => day.to_i }.delete_if { |key, value| value == 0 }
41
+ { 'year' => year,
42
+ 'month' => month,
43
+ 'day' => day }.compact
44
44
  end
45
45
 
46
46
  def get_iso8601_from_time(time)
@@ -46,7 +46,7 @@ module OrcidClient
46
46
  { :'put-code' => put_code,
47
47
  :'visibility' => 'public',
48
48
  :'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
49
- :'xsi:schemaLocation' => 'http://www.orcid.org/ns/external-identifier ../person-external-identifier-2.0_rc3.xsd',
49
+ :'xsi:schemaLocation' => 'http://www.orcid.org/ns/external-identifier ../person-external-identifier-2.0.xsd',
50
50
  :'xmlns:common' => 'http://www.orcid.org/ns/common',
51
51
  :'xmlns:external-identifier' => 'http://www.orcid.org/ns/external-identifier' }.compact
52
52
  end
@@ -5,12 +5,10 @@ require_relative 'api'
5
5
  require_relative 'author'
6
6
  require_relative 'base'
7
7
  require_relative 'date'
8
- require_relative 'metadata'
9
8
 
10
9
  module OrcidClient
11
10
  class Notification
12
11
  include OrcidClient::Base
13
- include OrcidClient::Metadata
14
12
  include OrcidClient::Author
15
13
  include OrcidClient::Date
16
14
  include OrcidClient::Api
@@ -30,11 +28,11 @@ module OrcidClient
30
28
  SCHEMA = File.expand_path("../../../resources/notification_#{API_VERSION}/notification-permission-#{API_VERSION}.xsd", __FILE__)
31
29
 
32
30
  def metadata
33
- @metadata ||= get_metadata(doi, 'datacite')
31
+ @metadata ||= Bolognese::Metadata.new(input: doi)
34
32
  end
35
33
 
36
34
  def item_name
37
- metadata.fetch('title', nil)
35
+ parse_attributes(metadata.title, content: "text", first: true)
38
36
  end
39
37
 
40
38
  def item_type
@@ -109,7 +107,7 @@ module OrcidClient
109
107
 
110
108
  def root_attributes
111
109
  { :'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
112
- :'xsi:schemaLocation' => 'http://www.orcid.org/ns/notification ../notification-permission-2.0_rc3.xsd',
110
+ :'xsi:schemaLocation' => 'http://www.orcid.org/ns/notification ../notification-permission-2.0.xsd',
113
111
  :'xmlns:common' => 'http://www.orcid.org/ns/common',
114
112
  :'xmlns:notification' => 'http://www.orcid.org/ns/notification' }
115
113
  end
@@ -1,3 +1,3 @@
1
1
  module OrcidClient
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3"
3
3
  end
@@ -6,19 +6,19 @@ require_relative 'api'
6
6
  require_relative 'author'
7
7
  require_relative 'base'
8
8
  require_relative 'date'
9
- require_relative 'metadata'
10
9
  require_relative 'work_type'
11
10
 
12
11
  module OrcidClient
13
12
  class Work
14
13
  include OrcidClient::Base
15
- include OrcidClient::Metadata
16
14
  include OrcidClient::Author
17
15
  include OrcidClient::Date
18
16
  include OrcidClient::WorkType
19
17
  include OrcidClient::Api
20
18
 
21
- attr_reader :doi, :orcid, :schema, :access_token, :put_code, :validation_errors
19
+ include Bolognese::Utils
20
+
21
+ attr_reader :doi, :orcid, :schema, :access_token, :put_code, :validation_errors, :name_detector
22
22
 
23
23
  def initialize(doi:, orcid:, access_token:, **options)
24
24
  @doi = doi
@@ -28,51 +28,46 @@ module OrcidClient
28
28
  end
29
29
 
30
30
  SCHEMA = File.expand_path("../../../resources/record_#{API_VERSION}/work-#{API_VERSION}.xsd", __FILE__)
31
+ # recognize given name. Can be loaded once as ::NameDetector, e.g. in a Rails initializer
32
+ def name_detector
33
+ @name_detector ||= defined?(::NameDetector) ? ::NameDetector : GenderDetector.new
34
+ end
31
35
 
32
36
  def metadata
33
- @metadata ||= get_metadata(doi, 'datacite')
37
+ @metadata ||= Bolognese::Metadata.new(input: doi)
34
38
  end
35
39
 
36
40
  def contributors
37
- Array(metadata.fetch('author', nil)).map do |contributor|
38
- { orcid: contributor.fetch('ORCID', nil),
39
- credit_name: get_credit_name(contributor),
41
+ Array.wrap(metadata.author).map do |contributor|
42
+ orcid = validate_orcid(contributor.fetch('id', nil))
43
+ orcid = "http://orcid.org/#{orcid}" if orcid.present?
44
+
45
+ { orcid: orcid,
46
+ credit_name: contributor.fetch('name', nil),
40
47
  role: nil }.compact
41
48
  end
42
49
  end
43
50
 
44
- def author_string
45
- Array(metadata.fetch('author', nil)).map do |contributor|
46
- get_full_name(contributor)
47
- end.join(" and ")
48
- end
49
-
50
- def sanitize(string)
51
- Sanitize.fragment(string).squish
52
- end
53
-
54
51
  def title
55
- metadata.fetch('title', nil)
52
+ parse_attributes(metadata.title, content: "text", first: true)
56
53
  end
57
54
 
55
+ # user publisher name as fallback
58
56
  def container_title
59
- metadata.fetch('container-title', nil)
60
- end
61
-
62
- def publisher_id
63
- metadata.fetch('publisher_id', nil)
57
+ metadata.container_title || metadata.publisher
64
58
  end
65
59
 
66
60
  def publication_date
67
- get_year_month_day(metadata.fetch('published', nil))
61
+ get_year_month_day(metadata.date_published)
68
62
  end
69
63
 
70
64
  def description
71
- sanitize(Array(metadata.fetch('description', nil)).first)
65
+ ct = parse_attributes(metadata.description, content: "text", first: true)
66
+ ct.squish if ct.present?
72
67
  end
73
68
 
74
69
  def type
75
- orcid_work_type(metadata.fetch('type', nil), metadata.fetch('subtype', nil))
70
+ orcid_work_type(metadata.resource_type_general, metadata.additional_type)
76
71
  end
77
72
 
78
73
  def has_required_elements?
@@ -158,7 +153,7 @@ module OrcidClient
158
153
  if contributor[:orcid].present?
159
154
  xml.send(:'common:contributor-orcid') do
160
155
  xml.send(:'common:uri', contributor[:orcid])
161
- xml.send(:'common:path', contributor[:orcid][17..-1])
156
+ xml.send(:'common:path', validate_orcid(contributor[:orcid]))
162
157
  xml.send(:'common:host', 'orcid.org')
163
158
  end
164
159
  end
@@ -184,7 +179,7 @@ module OrcidClient
184
179
  { :'put-code' => put_code,
185
180
  :'visibility' => 'public',
186
181
  :'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
187
- :'xsi:schemaLocation' => 'http://www.orcid.org/ns/work ../work-2.0_rc3.xsd',
182
+ :'xsi:schemaLocation' => 'http://www.orcid.org/ns/work ../work-2.0.xsd',
188
183
  :'xmlns:common' => 'http://www.orcid.org/ns/common',
189
184
  :'xmlns:work' => 'http://www.orcid.org/ns/work' }.compact
190
185
  end
data/lib/orcid_client.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'bolognese'
2
+
1
3
  require "orcid_client/work"
2
4
  require "orcid_client/notification"
3
5
  require "orcid_client/external_identifier"
data/orcid_client.gemspec CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # Declary dependencies here, rather than in the Gemfile
22
- s.add_dependency 'maremma', '~> 3.0'
23
- s.add_dependency 'nokogiri', '~> 1.6.8'
22
+ s.add_dependency 'maremma', '~> 3.5', '>= 3.5.7'
23
+ s.add_dependency 'bolognese', '~> 0.9.26'
24
+ s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
24
25
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
25
26
  s.add_dependency 'namae', '~> 0.11.3'
26
- s.add_dependency 'activesupport', '~> 4.2', '>= 4.2.5'
27
+ s.add_dependency 'activesupport', '>= 4.2.5', '< 6'
27
28
  s.add_dependency 'sanitize', '~> 4.0', '>= 4.0.1'
28
29
  s.add_dependency 'dotenv', '~> 2.1', '>= 2.1.1'
29
30
  s.add_development_dependency 'bundler', '~> 1.0'
@@ -31,7 +32,7 @@ Gem::Specification.new do |s|
31
32
  s.add_development_dependency 'rake'
32
33
  s.add_development_dependency 'rack-test', '~> 0'
33
34
  s.add_development_dependency 'vcr'
34
- s.add_development_dependency 'webmock', '~> 1.22', '>= 1.22.3'
35
+ s.add_development_dependency 'webmock', '~> 3.0', '>= 3.0.1'
35
36
  s.add_development_dependency 'codeclimate-test-reporter', "~> 1.0.0"
36
37
  s.add_development_dependency 'simplecov'
37
38
  end