puree 0.20.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -2
  3. data/PITCHME.md +43 -21
  4. data/README.md +72 -18
  5. data/lib/puree.rb +66 -21
  6. data/lib/puree/api/api.rb +9 -0
  7. data/lib/puree/api/authentication.rb +33 -0
  8. data/lib/puree/api/configuration.rb +43 -0
  9. data/lib/puree/api/map.rb +76 -0
  10. data/lib/puree/api/request.rb +116 -0
  11. data/lib/puree/extractor/collection.rb +131 -0
  12. data/lib/puree/extractor/dataset.rb +48 -0
  13. data/lib/puree/extractor/download.rb +71 -0
  14. data/lib/puree/extractor/event.rb +33 -0
  15. data/lib/puree/extractor/extractor.rb +10 -0
  16. data/lib/puree/extractor/journal.rb +29 -0
  17. data/lib/puree/extractor/organisation.rb +34 -0
  18. data/lib/puree/extractor/person.rb +32 -0
  19. data/lib/puree/extractor/project.rb +40 -0
  20. data/lib/puree/extractor/publication.rb +40 -0
  21. data/lib/puree/extractor/publisher.rb +27 -0
  22. data/lib/puree/extractor/resource.rb +69 -0
  23. data/lib/puree/extractor/server.rb +56 -0
  24. data/lib/puree/model/address.rb +50 -0
  25. data/lib/puree/model/copyright_license.rb +26 -0
  26. data/lib/puree/model/dataset.rb +84 -0
  27. data/lib/puree/model/download_header.rb +21 -0
  28. data/lib/puree/model/endeavour_person.rb +34 -0
  29. data/lib/puree/model/event.rb +31 -0
  30. data/lib/puree/model/event_header.rb +26 -0
  31. data/lib/puree/model/file.rb +45 -0
  32. data/lib/puree/model/helper/validation.rb +15 -0
  33. data/lib/puree/model/journal.rb +20 -0
  34. data/lib/puree/model/legal_condition.rb +26 -0
  35. data/lib/puree/model/link.rb +26 -0
  36. data/lib/puree/model/model.rb +7 -0
  37. data/lib/puree/model/organisation.rb +34 -0
  38. data/lib/puree/model/organisation_header.rb +34 -0
  39. data/lib/puree/model/person.rb +28 -0
  40. data/lib/puree/model/person_name.rb +52 -0
  41. data/lib/puree/model/project.rb +49 -0
  42. data/lib/puree/model/publication.rb +53 -0
  43. data/lib/puree/model/publication_status.rb +21 -0
  44. data/lib/puree/model/publisher.rb +13 -0
  45. data/lib/puree/model/related_content_header.rb +34 -0
  46. data/lib/puree/model/resource.rb +42 -0
  47. data/lib/puree/model/server.rb +13 -0
  48. data/lib/puree/model/spatial_point.rb +16 -0
  49. data/lib/puree/model/structure.rb +18 -0
  50. data/lib/puree/model/temporal_range.rb +15 -0
  51. data/lib/puree/util/date.rb +86 -0
  52. data/lib/puree/util/util.rb +8 -0
  53. data/lib/puree/version.rb +1 -1
  54. data/lib/puree/xml_extractor/base.rb +47 -0
  55. data/lib/puree/xml_extractor/collection.rb +40 -0
  56. data/lib/puree/xml_extractor/dataset.rb +305 -0
  57. data/lib/puree/xml_extractor/download.rb +42 -0
  58. data/lib/puree/xml_extractor/event.rb +63 -0
  59. data/lib/puree/xml_extractor/journal.rb +33 -0
  60. data/lib/puree/xml_extractor/organisation.rb +75 -0
  61. data/lib/puree/xml_extractor/person.rb +57 -0
  62. data/lib/puree/xml_extractor/project.rb +135 -0
  63. data/lib/puree/xml_extractor/publication.rb +189 -0
  64. data/lib/puree/xml_extractor/publisher.rb +28 -0
  65. data/lib/puree/xml_extractor/resource.rb +71 -0
  66. data/lib/puree/xml_extractor/server.rb +32 -0
  67. data/lib/puree/xml_extractor/shared.rb +31 -0
  68. data/lib/puree/xml_extractor/xml_extractor.rb +10 -0
  69. data/puree.gemspec +11 -8
  70. data/spec/download_http_spec.rb +31 -0
  71. data/spec/open_api_dataset_http_spec.rb +15 -0
  72. data/spec/resource/collection_all_http_spec.rb +77 -0
  73. data/spec/resource/collection_http_spec.rb +65 -0
  74. data/spec/resource/dataset_http_spec.rb +104 -0
  75. data/spec/resource/event_http_spec.rb +52 -0
  76. data/spec/resource/journal_http_spec.rb +36 -0
  77. data/spec/resource/organisation_http_spec.rb +52 -0
  78. data/spec/resource/person_http_spec.rb +48 -0
  79. data/spec/resource/project_http_spec.rb +76 -0
  80. data/spec/resource/publication_http_spec.rb +78 -0
  81. data/spec/resource/publisher_http_spec.rb +26 -0
  82. data/spec/server_http_spec.rb +26 -0
  83. data/spec/spec_helper.rb +106 -21
  84. metadata +110 -46
  85. data/lib/puree/collection.rb +0 -285
  86. data/lib/puree/configuration.rb +0 -15
  87. data/lib/puree/dataset.rb +0 -483
  88. data/lib/puree/date.rb +0 -63
  89. data/lib/puree/download.rb +0 -189
  90. data/lib/puree/event.rb +0 -133
  91. data/lib/puree/journal.rb +0 -75
  92. data/lib/puree/map.rb +0 -68
  93. data/lib/puree/organisation.rb +0 -177
  94. data/lib/puree/person.rb +0 -136
  95. data/lib/puree/project.rb +0 -231
  96. data/lib/puree/publication.rb +0 -258
  97. data/lib/puree/publisher.rb +0 -64
  98. data/lib/puree/resource.rb +0 -261
  99. data/lib/puree/server.rb +0 -156
  100. data/spec/collection_spec.rb +0 -62
  101. data/spec/dataset_spec.rb +0 -148
  102. data/spec/download_spec.rb +0 -33
  103. data/spec/event_spec.rb +0 -108
  104. data/spec/journal_spec.rb +0 -92
  105. data/spec/organisation_spec.rb +0 -112
  106. data/spec/person_spec.rb +0 -104
  107. data/spec/project_spec.rb +0 -120
  108. data/spec/publication_spec.rb +0 -128
  109. data/spec/publisher_spec.rb +0 -89
  110. data/spec/server_spec.rb +0 -36
data/spec/journal_spec.rb DELETED
@@ -1,92 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Journal' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_JOURNAL_UUID']
10
- @p = Puree::Journal.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Journal.new
19
- expect(p).to be_an_instance_of Puree::Journal
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#created' do
32
- expect(@p.created).to be_an_instance_of(String)
33
- end
34
-
35
- it '#issn' do
36
- expect(@p.issn).to be_an_instance_of(String)
37
- end
38
-
39
- it '#locale' do
40
- expect(@p.locale).to be_an_instance_of(String)
41
- end
42
-
43
- it '#metadata' do
44
- expect(@p.metadata).to be_an_instance_of(Hash)
45
- end
46
-
47
- it '#metadata' do
48
- expect(@p.metadata).not_to be_empty
49
- end
50
-
51
- it '#modified' do
52
- expect(@p.modified).to be_an_instance_of(String)
53
- end
54
-
55
- it '#publisher' do
56
- expect(@p.publisher).to be_an_instance_of(String)
57
- end
58
-
59
- it '#title' do
60
- expect(@p.title).to be_an_instance_of(String)
61
- end
62
-
63
- it '#uuid' do
64
- expect(@p.uuid).to be_an_instance_of(String)
65
- end
66
- end
67
-
68
- describe 'data retrieval from file' do
69
- before(:all) do
70
- request
71
-
72
- filename = "#{ENV['PURE_FILE_PATH']}journal.#{@uuid}.xml"
73
- File.write(filename, @p.response.body)
74
-
75
- @metadata = @p.set_content File.read(filename)
76
- end
77
-
78
- it '#set_content' do
79
- expect(@metadata).to be_an_instance_of(Hash)
80
- end
81
-
82
- it '#metadata' do
83
- expect(@p.metadata).to be_an_instance_of(Hash)
84
- end
85
-
86
- it '#metadata' do
87
- expect(@p.metadata).not_to be_empty
88
- end
89
-
90
- end
91
-
92
- end
@@ -1,112 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Organisation' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_ORGANISATION_UUID']
10
- @p = Puree::Organisation.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Organisation.new
19
- expect(p).to be_an_instance_of Puree::Organisation
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#address' do
32
- expect(@p.address).to be_an_instance_of(Array)
33
- end
34
-
35
- it '#created' do
36
- expect(@p.created).to be_an_instance_of(String)
37
- end
38
-
39
- it '#email' do
40
- expect(@p.email).to be_an_instance_of(Array)
41
- end
42
-
43
- it '#locale' do
44
- expect(@p.locale).to be_an_instance_of(String)
45
- end
46
-
47
- it '#metadata' do
48
- expect(@p.metadata).to be_an_instance_of(Hash)
49
- end
50
-
51
- it '#metadata' do
52
- expect(@p.metadata).not_to be_empty
53
- end
54
-
55
- it '#modified' do
56
- expect(@p.modified).to be_an_instance_of(String)
57
- end
58
-
59
- it '#name' do
60
- expect(@p.name).to be_an_instance_of(String)
61
- end
62
-
63
- it '#organisation' do
64
- expect(@p.organisation).to be_an_instance_of(Array)
65
- end
66
-
67
- it '#parent' do
68
- expect(@p.parent).to be_an_instance_of(Hash)
69
- end
70
-
71
- it '#phone' do
72
- expect(@p.phone).to be_an_instance_of(Array)
73
- end
74
-
75
- it '#type' do
76
- expect(@p.type).to be_an_instance_of(String)
77
- end
78
-
79
- it '#url' do
80
- expect(@p.url).to be_an_instance_of(Array)
81
- end
82
-
83
- it '#uuid' do
84
- expect(@p.uuid).to be_an_instance_of(String)
85
- end
86
- end
87
-
88
- describe 'data retrieval from file' do
89
- before(:all) do
90
- request
91
-
92
- filename = "#{ENV['PURE_FILE_PATH']}organisation.#{@uuid}.xml"
93
- File.write(filename, @p.response.body)
94
-
95
- @metadata = @p.set_content File.read(filename)
96
- end
97
-
98
- it '#set_content' do
99
- expect(@metadata).to be_an_instance_of(Hash)
100
- end
101
-
102
- it '#metadata' do
103
- expect(@p.metadata).to be_an_instance_of(Hash)
104
- end
105
-
106
- it '#metadata' do
107
- expect(@p.metadata).not_to be_empty
108
- end
109
-
110
- end
111
-
112
- end
data/spec/person_spec.rb DELETED
@@ -1,104 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Person' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_PERSON_UUID']
10
- @p = Puree::Person.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Person.new
19
- expect(p).to be_an_instance_of Puree::Person
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#affiliation' do
32
- expect(@p.affiliation).to be_an_instance_of(Array)
33
- end
34
-
35
- it '#created' do
36
- expect(@p.created).to be_an_instance_of(String)
37
- end
38
-
39
- it '#email' do
40
- expect(@p.email).to be_an_instance_of(Array)
41
- end
42
-
43
- it '#image' do
44
- expect(@p.image).to be_an_instance_of(Array)
45
- end
46
-
47
- it '#keyword' do
48
- expect(@p.keyword).to be_an_instance_of(Array)
49
- end
50
-
51
- it '#locale' do
52
- expect(@p.locale).to be_an_instance_of(String)
53
- end
54
-
55
- it '#metadata' do
56
- expect(@p.metadata).to be_an_instance_of(Hash)
57
- end
58
-
59
- it '#metadata' do
60
- expect(@p.metadata).not_to be_empty
61
- end
62
-
63
- it '#modified' do
64
- expect(@p.modified).to be_an_instance_of(String)
65
- end
66
-
67
- it '#name' do
68
- expect(@p.name).to be_an_instance_of(Hash)
69
- end
70
-
71
- it '#orcid' do
72
- expect(@p.orcid).to be_an_instance_of(String)
73
- end
74
-
75
- it '#uuid' do
76
- expect(@p.uuid).to be_an_instance_of(String)
77
- end
78
- end
79
-
80
- describe 'data retrieval from file' do
81
- before(:all) do
82
- request
83
-
84
- filename = "#{ENV['PURE_FILE_PATH']}person.#{@uuid}.xml"
85
- File.write(filename, @p.response.body)
86
-
87
- @metadata = @p.set_content File.read(filename)
88
- end
89
-
90
- it '#set_content' do
91
- expect(@metadata).to be_an_instance_of(Hash)
92
- end
93
-
94
- it '#metadata' do
95
- expect(@p.metadata).to be_an_instance_of(Hash)
96
- end
97
-
98
- it '#metadata' do
99
- expect(@p.metadata).not_to be_empty
100
- end
101
-
102
- end
103
-
104
- end
data/spec/project_spec.rb DELETED
@@ -1,120 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Project' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_PROJECT_UUID']
10
- @p = Puree::Project.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Project.new
19
- expect(p).to be_an_instance_of Puree::Project
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#acronym' do
32
- expect(@p.acronym).to be_an_instance_of(String)
33
- end
34
-
35
- it '#created' do
36
- expect(@p.created).to be_an_instance_of(String)
37
- end
38
-
39
- it '#description' do
40
- expect(@p.description).to be_an_instance_of(String)
41
- end
42
-
43
- it '#locale' do
44
- expect(@p.locale).to be_an_instance_of(String)
45
- end
46
-
47
- it '#metadata' do
48
- expect(@p.metadata).to be_an_instance_of(Hash)
49
- end
50
-
51
- it '#metadata' do
52
- expect(@p.metadata).not_to be_empty
53
- end
54
-
55
- it '#modified' do
56
- expect(@p.modified).to be_an_instance_of(String)
57
- end
58
-
59
- it '#organisation' do
60
- expect(@p.organisation).to be_an_instance_of(Array)
61
- end
62
-
63
- it '#owner' do
64
- expect(@p.owner).to be_an_instance_of(Hash)
65
- end
66
-
67
- it '#person' do
68
- expect(@p.person).to be_an_instance_of(Hash)
69
- end
70
-
71
- it '#status' do
72
- expect(@p.status).to be_an_instance_of(String)
73
- end
74
-
75
- it '#temporal' do
76
- expect(@p.temporal).to be_an_instance_of(Hash)
77
- end
78
-
79
- it '#title' do
80
- expect(@p.title).to be_an_instance_of(String)
81
- end
82
-
83
- it '#type' do
84
- expect(@p.type).to be_an_instance_of(String)
85
- end
86
-
87
- it '#url' do
88
- expect(@p.url).to be_an_instance_of(String)
89
- end
90
-
91
- it '#uuid' do
92
- expect(@p.uuid).to be_an_instance_of(String)
93
- end
94
- end
95
-
96
- describe 'data retrieval from file' do
97
- before(:all) do
98
- request
99
-
100
- filename = "#{ENV['PURE_FILE_PATH']}project.#{@uuid}.xml"
101
- File.write(filename, @p.response.body)
102
-
103
- @metadata = @p.set_content File.read(filename)
104
- end
105
-
106
- it '#set_content' do
107
- expect(@metadata).to be_an_instance_of(Hash)
108
- end
109
-
110
- it '#metadata' do
111
- expect(@p.metadata).to be_an_instance_of(Hash)
112
- end
113
-
114
- it '#metadata' do
115
- expect(@p.metadata).not_to be_empty
116
- end
117
-
118
- end
119
-
120
- end
@@ -1,128 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Publication' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_PUBLICATION_UUID']
10
- @p = Puree::Publication.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Publication.new
19
- expect(p).to be_an_instance_of Puree::Publication
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#category' do
32
- expect(@p.category).to be_an_instance_of(String)
33
- end
34
-
35
- it '#created' do
36
- expect(@p.created).to be_an_instance_of(String)
37
- end
38
-
39
- it '#description' do
40
- expect(@p.description).to be_an_instance_of(String)
41
- end
42
-
43
- it '#doi' do
44
- expect(@p.doi).to be_an_instance_of(String)
45
- end
46
-
47
- it '#event' do
48
- expect(@p.event).to be_an_instance_of(Hash)
49
- end
50
-
51
- it '#file' do
52
- expect(@p.file).to be_an_instance_of(Array)
53
- end
54
-
55
- it '#locale' do
56
- expect(@p.locale).to be_an_instance_of(String)
57
- end
58
-
59
- it '#metadata' do
60
- expect(@p.metadata).to be_an_instance_of(Hash)
61
- end
62
-
63
- it '#metadata' do
64
- expect(@p.metadata).not_to be_empty
65
- end
66
-
67
- it '#modified' do
68
- expect(@p.modified).to be_an_instance_of(String)
69
- end
70
-
71
- it '#organisation' do
72
- expect(@p.organisation).to be_an_instance_of(Array)
73
- end
74
-
75
- it '#page' do
76
- expect(@p.page).to be_an_instance_of(String)
77
- end
78
-
79
- it '#person' do
80
- expect(@p.person).to be_an_instance_of(Hash)
81
- end
82
-
83
- it '#status' do
84
- expect(@p.status).to be_an_instance_of(Array)
85
- end
86
-
87
- it '#subtitle' do
88
- expect(@p.subtitle).to be_an_instance_of(String)
89
- end
90
-
91
- it '#title' do
92
- expect(@p.title).to be_an_instance_of(String)
93
- end
94
-
95
- it '#type' do
96
- expect(@p.type).to be_an_instance_of(String)
97
- end
98
-
99
- it '#uuid' do
100
- expect(@p.uuid).to be_an_instance_of(String)
101
- end
102
- end
103
-
104
- describe 'data retrieval from file' do
105
- before(:all) do
106
- request
107
-
108
- filename = "#{ENV['PURE_FILE_PATH']}publication.#{@uuid}.xml"
109
- File.write(filename, @p.response.body)
110
-
111
- @metadata = @p.set_content File.read(filename)
112
- end
113
-
114
- it '#set_content' do
115
- expect(@metadata).to be_an_instance_of(Hash)
116
- end
117
-
118
- it '#metadata' do
119
- expect(@p.metadata).to be_an_instance_of(Hash)
120
- end
121
-
122
- it '#metadata' do
123
- expect(@p.metadata).not_to be_empty
124
- end
125
-
126
- end
127
-
128
- end