puree 0.20.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -2
- data/PITCHME.md +43 -21
- data/README.md +72 -18
- data/lib/puree.rb +66 -21
- data/lib/puree/api/api.rb +9 -0
- data/lib/puree/api/authentication.rb +33 -0
- data/lib/puree/api/configuration.rb +43 -0
- data/lib/puree/api/map.rb +76 -0
- data/lib/puree/api/request.rb +116 -0
- data/lib/puree/extractor/collection.rb +131 -0
- data/lib/puree/extractor/dataset.rb +48 -0
- data/lib/puree/extractor/download.rb +71 -0
- data/lib/puree/extractor/event.rb +33 -0
- data/lib/puree/extractor/extractor.rb +10 -0
- data/lib/puree/extractor/journal.rb +29 -0
- data/lib/puree/extractor/organisation.rb +34 -0
- data/lib/puree/extractor/person.rb +32 -0
- data/lib/puree/extractor/project.rb +40 -0
- data/lib/puree/extractor/publication.rb +40 -0
- data/lib/puree/extractor/publisher.rb +27 -0
- data/lib/puree/extractor/resource.rb +69 -0
- data/lib/puree/extractor/server.rb +56 -0
- data/lib/puree/model/address.rb +50 -0
- data/lib/puree/model/copyright_license.rb +26 -0
- data/lib/puree/model/dataset.rb +84 -0
- data/lib/puree/model/download_header.rb +21 -0
- data/lib/puree/model/endeavour_person.rb +34 -0
- data/lib/puree/model/event.rb +31 -0
- data/lib/puree/model/event_header.rb +26 -0
- data/lib/puree/model/file.rb +45 -0
- data/lib/puree/model/helper/validation.rb +15 -0
- data/lib/puree/model/journal.rb +20 -0
- data/lib/puree/model/legal_condition.rb +26 -0
- data/lib/puree/model/link.rb +26 -0
- data/lib/puree/model/model.rb +7 -0
- data/lib/puree/model/organisation.rb +34 -0
- data/lib/puree/model/organisation_header.rb +34 -0
- data/lib/puree/model/person.rb +28 -0
- data/lib/puree/model/person_name.rb +52 -0
- data/lib/puree/model/project.rb +49 -0
- data/lib/puree/model/publication.rb +53 -0
- data/lib/puree/model/publication_status.rb +21 -0
- data/lib/puree/model/publisher.rb +13 -0
- data/lib/puree/model/related_content_header.rb +34 -0
- data/lib/puree/model/resource.rb +42 -0
- data/lib/puree/model/server.rb +13 -0
- data/lib/puree/model/spatial_point.rb +16 -0
- data/lib/puree/model/structure.rb +18 -0
- data/lib/puree/model/temporal_range.rb +15 -0
- data/lib/puree/util/date.rb +86 -0
- data/lib/puree/util/util.rb +8 -0
- data/lib/puree/version.rb +1 -1
- data/lib/puree/xml_extractor/base.rb +47 -0
- data/lib/puree/xml_extractor/collection.rb +40 -0
- data/lib/puree/xml_extractor/dataset.rb +305 -0
- data/lib/puree/xml_extractor/download.rb +42 -0
- data/lib/puree/xml_extractor/event.rb +63 -0
- data/lib/puree/xml_extractor/journal.rb +33 -0
- data/lib/puree/xml_extractor/organisation.rb +75 -0
- data/lib/puree/xml_extractor/person.rb +57 -0
- data/lib/puree/xml_extractor/project.rb +135 -0
- data/lib/puree/xml_extractor/publication.rb +189 -0
- data/lib/puree/xml_extractor/publisher.rb +28 -0
- data/lib/puree/xml_extractor/resource.rb +71 -0
- data/lib/puree/xml_extractor/server.rb +32 -0
- data/lib/puree/xml_extractor/shared.rb +31 -0
- data/lib/puree/xml_extractor/xml_extractor.rb +10 -0
- data/puree.gemspec +11 -8
- data/spec/download_http_spec.rb +31 -0
- data/spec/open_api_dataset_http_spec.rb +15 -0
- data/spec/resource/collection_all_http_spec.rb +77 -0
- data/spec/resource/collection_http_spec.rb +65 -0
- data/spec/resource/dataset_http_spec.rb +104 -0
- data/spec/resource/event_http_spec.rb +52 -0
- data/spec/resource/journal_http_spec.rb +36 -0
- data/spec/resource/organisation_http_spec.rb +52 -0
- data/spec/resource/person_http_spec.rb +48 -0
- data/spec/resource/project_http_spec.rb +76 -0
- data/spec/resource/publication_http_spec.rb +78 -0
- data/spec/resource/publisher_http_spec.rb +26 -0
- data/spec/server_http_spec.rb +26 -0
- data/spec/spec_helper.rb +106 -21
- metadata +110 -46
- data/lib/puree/collection.rb +0 -285
- data/lib/puree/configuration.rb +0 -15
- data/lib/puree/dataset.rb +0 -483
- data/lib/puree/date.rb +0 -63
- data/lib/puree/download.rb +0 -189
- data/lib/puree/event.rb +0 -133
- data/lib/puree/journal.rb +0 -75
- data/lib/puree/map.rb +0 -68
- data/lib/puree/organisation.rb +0 -177
- data/lib/puree/person.rb +0 -136
- data/lib/puree/project.rb +0 -231
- data/lib/puree/publication.rb +0 -258
- data/lib/puree/publisher.rb +0 -64
- data/lib/puree/resource.rb +0 -261
- data/lib/puree/server.rb +0 -156
- data/spec/collection_spec.rb +0 -62
- data/spec/dataset_spec.rb +0 -148
- data/spec/download_spec.rb +0 -33
- data/spec/event_spec.rb +0 -108
- data/spec/journal_spec.rb +0 -92
- data/spec/organisation_spec.rb +0 -112
- data/spec/person_spec.rb +0 -104
- data/spec/project_spec.rb +0 -120
- data/spec/publication_spec.rb +0 -128
- data/spec/publisher_spec.rb +0 -89
- data/spec/server_spec.rb +0 -36
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Event' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Event.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Event
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :event
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
resource_header
|
17
|
+
|
18
|
+
it 'data structure' do
|
19
|
+
expect(@p).to be_a Puree::Model::Event
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#city' do
|
23
|
+
expect(@p.city).to be_a String if @p.city
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#country' do
|
27
|
+
expect(@p.country).to be_a String if @p.country
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#date' do
|
31
|
+
expect(@p.date).to be_a Puree::Model::TemporalRange if @p.date
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#description' do
|
35
|
+
expect(@p.description).to be_a String if @p.description
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#location' do
|
39
|
+
expect(@p.location).to be_a String if @p.location
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#title' do
|
43
|
+
expect(@p.title).to be_a String if @p.title
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#type' do
|
47
|
+
expect(@p.type).to be_a String if @p.type
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Journal' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Journal.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Journal
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :journal
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
resource_header
|
17
|
+
|
18
|
+
it 'data structure' do
|
19
|
+
expect(@p).to be_a Puree::Model::Journal
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#issn' do
|
23
|
+
expect(@p.issn).to be_a String if @p.issn
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#publisher' do
|
27
|
+
expect(@p.publisher).to be_a String if @p.publisher
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#title' do
|
31
|
+
expect(@p.title).to be_a String if @p.title
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Organisation' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Organisation.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Organisation
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :organisation
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
resource_header
|
17
|
+
|
18
|
+
it 'data structure' do
|
19
|
+
expect(@p).to be_a Puree::Model::Organisation
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#address' do
|
23
|
+
expect(@p.address).to all( be_a Puree::Model::Address )
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#name' do
|
27
|
+
expect(@p.name).to be_a String if @p.name
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#organisations' do
|
31
|
+
expect(@p.organisations).to all( be_a Puree::Model::OrganisationHeader )
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#parent' do
|
35
|
+
expect(@p.parent).to be_a Puree::Model::OrganisationHeader if @p.parent
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#phone_numbers' do
|
39
|
+
expect(@p.phone_numbers).to all( be_a String )
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#type' do
|
43
|
+
expect(@p.type).to be_a String if @p.type
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#urls' do
|
47
|
+
expect(@p.urls).to all( be_a String )
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Person' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Person.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Person
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :person
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
resource_header
|
17
|
+
|
18
|
+
it 'data structure' do
|
19
|
+
expect(@p).to be_a Puree::Model::Person
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#affiliations' do
|
23
|
+
expect(@p.affiliations).to all( be_a Puree::Model::OrganisationHeader )
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#email_addresses' do
|
27
|
+
expect(@p.email_addresses).to all( be_a String )
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#image_urls' do
|
31
|
+
expect(@p.image_urls).to all( be_a String )
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#keywords' do
|
35
|
+
expect(@p.keywords).to all( be_a String )
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#name' do
|
39
|
+
expect(@p.name).to be_a Puree::Model::PersonName if @p.name
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#orcid' do
|
43
|
+
expect(@p.orcid).to be_a String if @p.orcid
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Project' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Project.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Project
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :project
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
resource_header
|
17
|
+
|
18
|
+
it 'data structure' do
|
19
|
+
expect(@p).to be_a Puree::Model::Project
|
20
|
+
end
|
21
|
+
|
22
|
+
it '#acronym' do
|
23
|
+
expect(@p.acronym).to be_a String if @p.acronym
|
24
|
+
end
|
25
|
+
|
26
|
+
it '#description' do
|
27
|
+
expect(@p.description).to be_a String if @p.description
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#organisations' do
|
31
|
+
expect(@p.organisations).to all( be_a Puree::Model::OrganisationHeader )
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#owner' do
|
35
|
+
expect(@p.owner).to be_a Puree::Model::OrganisationHeader if @p.owner
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#persons_internal' do
|
39
|
+
expect(@p.persons_internal).to all( be_a Puree::Model::EndeavourPerson )
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#persons_external' do
|
43
|
+
expect(@p.persons_external).to all( be_a Puree::Model::EndeavourPerson )
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#persons_other' do
|
47
|
+
expect(@p.persons_other).to all( be_a Puree::Model::EndeavourPerson )
|
48
|
+
end
|
49
|
+
|
50
|
+
it '#status' do
|
51
|
+
expect(@p.status).to be_a String if @p.status
|
52
|
+
end
|
53
|
+
|
54
|
+
it '#temporal_actual' do
|
55
|
+
expect(@p.temporal_actual).to be_a Puree::Model::TemporalRange if @p.temporal_actual
|
56
|
+
end
|
57
|
+
|
58
|
+
it '#temporal_expected' do
|
59
|
+
expect(@p.temporal_expected).to be_a Puree::Model::TemporalRange if @p.temporal_expected
|
60
|
+
end
|
61
|
+
|
62
|
+
it '#title' do
|
63
|
+
expect(@p.title).to be_a String if @p.title
|
64
|
+
end
|
65
|
+
|
66
|
+
it '#type' do
|
67
|
+
expect(@p.type).to be_a String if @p.type
|
68
|
+
end
|
69
|
+
|
70
|
+
it '#url' do
|
71
|
+
expect(@p.url).to be_a String if @p.url
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Publication' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Publication.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Publication
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :publication
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
it 'data structure' do
|
17
|
+
expect(@p).to be_a Puree::Model::Publication
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#category' do
|
21
|
+
expect(@p.category).to be_a String if @p.category
|
22
|
+
end
|
23
|
+
|
24
|
+
it '#description' do
|
25
|
+
expect(@p.description).to be_a String if @p.description
|
26
|
+
end
|
27
|
+
|
28
|
+
it '#doi' do
|
29
|
+
expect(@p.doi).to be_a String if @p.doi
|
30
|
+
end
|
31
|
+
|
32
|
+
it '#event' do
|
33
|
+
expect(@p.event).to be_a Puree::Model::EventHeader if @p.event
|
34
|
+
end
|
35
|
+
|
36
|
+
it '#files' do
|
37
|
+
expect(@p.files).to all( be_a Puree::Model::File )
|
38
|
+
end
|
39
|
+
|
40
|
+
it '#organisations' do
|
41
|
+
expect(@p.organisations).to all( be_a Puree::Model::OrganisationHeader )
|
42
|
+
end
|
43
|
+
|
44
|
+
it '#pages' do
|
45
|
+
expect(@p.pages).to be_a Fixnum if @p.pages
|
46
|
+
end
|
47
|
+
|
48
|
+
it '#persons_internal' do
|
49
|
+
expect(@p.persons_internal).to all( be_a Puree::Model::EndeavourPerson )
|
50
|
+
end
|
51
|
+
|
52
|
+
it '#persons_external' do
|
53
|
+
expect(@p.persons_external).to all( be_a Puree::Model::EndeavourPerson )
|
54
|
+
end
|
55
|
+
|
56
|
+
it '#persons_other' do
|
57
|
+
expect(@p.persons_other).to all( be_a Puree::Model::EndeavourPerson )
|
58
|
+
end
|
59
|
+
|
60
|
+
it '#statuses' do
|
61
|
+
expect(@p.statuses).to all( be_a Puree::Model::PublicationStatus )
|
62
|
+
end
|
63
|
+
|
64
|
+
it '#subtitle' do
|
65
|
+
expect(@p.subtitle).to be_a String if @p.subtitle
|
66
|
+
end
|
67
|
+
|
68
|
+
it '#title' do
|
69
|
+
expect(@p.title).to be_a String if @p.title
|
70
|
+
end
|
71
|
+
|
72
|
+
it '#type' do
|
73
|
+
expect(@p.type).to be_a String if @p.type
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Publisher' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
p = Puree::Extractor::Publisher.new config
|
7
|
+
expect(p).to be_a Puree::Extractor::Publisher
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:all) do
|
11
|
+
request :publisher
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'data retrieval' do
|
15
|
+
|
16
|
+
it 'data structure' do
|
17
|
+
expect(@p).to be_a Puree::Model::Publisher
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#name' do
|
21
|
+
expect(@p.name).to be_a String if @p.name
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Server' do
|
4
|
+
|
5
|
+
it '#new' do
|
6
|
+
extractor = Puree::Extractor::Server.new config
|
7
|
+
expect(extractor).to be_a Puree::Extractor::Server
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'data retrieval' do
|
11
|
+
before(:all) do
|
12
|
+
@extractor = Puree::Extractor::Server.new config
|
13
|
+
@p = @extractor.find
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#find' do
|
17
|
+
expect(@p).to be_a Puree::Model::Server
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#version' do
|
21
|
+
expect(@p.version).to be_a String if @p.version
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,27 +1,112 @@
|
|
1
1
|
require 'http'
|
2
2
|
require 'nokogiri'
|
3
|
-
require 'puree/configuration'
|
4
|
-
require 'puree/date'
|
5
|
-
require 'puree/map'
|
6
|
-
require 'puree/resource'
|
7
|
-
require 'puree/dataset'
|
8
|
-
require 'puree/event'
|
9
|
-
require 'puree/journal'
|
10
|
-
require 'puree/organisation'
|
11
|
-
require 'puree/person'
|
12
|
-
require 'puree/project'
|
13
|
-
require 'puree/publication'
|
14
|
-
require 'puree/publisher'
|
15
|
-
require 'puree/collection'
|
16
|
-
require 'puree/download'
|
17
|
-
require 'puree/server'
|
18
|
-
|
19
|
-
module Puree
|
20
|
-
|
21
|
-
class << self
|
22
|
-
|
23
|
-
include Puree::Configuration
|
24
3
|
|
4
|
+
require 'puree/version'
|
5
|
+
|
6
|
+
require 'puree/util/date'
|
7
|
+
|
8
|
+
require 'puree/xml_extractor/shared'
|
9
|
+
require 'puree/xml_extractor/base'
|
10
|
+
require 'puree/xml_extractor/collection'
|
11
|
+
require 'puree/xml_extractor/resource'
|
12
|
+
require 'puree/xml_extractor/dataset'
|
13
|
+
require 'puree/xml_extractor/download'
|
14
|
+
require 'puree/xml_extractor/event'
|
15
|
+
require 'puree/xml_extractor/journal'
|
16
|
+
require 'puree/xml_extractor/organisation'
|
17
|
+
require 'puree/xml_extractor/person'
|
18
|
+
require 'puree/xml_extractor/project'
|
19
|
+
require 'puree/xml_extractor/publication'
|
20
|
+
require 'puree/xml_extractor/publisher'
|
21
|
+
require 'puree/xml_extractor/server'
|
22
|
+
|
23
|
+
require 'puree/api/map'
|
24
|
+
require 'puree/api/request'
|
25
|
+
require 'puree/api/configuration'
|
26
|
+
require 'puree/api/authentication'
|
27
|
+
|
28
|
+
require 'puree/model/structure'
|
29
|
+
|
30
|
+
require 'puree/model/resource'
|
31
|
+
require 'puree/model/dataset'
|
32
|
+
require 'puree/model/download_header'
|
33
|
+
require 'puree/model/event'
|
34
|
+
require 'puree/model/event'
|
35
|
+
require 'puree/model/journal'
|
36
|
+
require 'puree/model/link'
|
37
|
+
require 'puree/model/organisation'
|
38
|
+
require 'puree/model/person'
|
39
|
+
require 'puree/model/project'
|
40
|
+
require 'puree/model/publication'
|
41
|
+
require 'puree/model/publisher'
|
42
|
+
require 'puree/model/related_content_header'
|
43
|
+
require 'puree/model/spatial_point'
|
44
|
+
|
45
|
+
require 'puree/model/address'
|
46
|
+
require 'puree/model/copyright_license'
|
47
|
+
require 'puree/model/event_header'
|
48
|
+
require 'puree/model/file'
|
49
|
+
require 'puree/model/legal_condition'
|
50
|
+
require 'puree/model/organisation_header'
|
51
|
+
require 'puree/model/endeavour_person'
|
52
|
+
require 'puree/model/person_name'
|
53
|
+
require 'puree/model/publication_status'
|
54
|
+
require 'puree/model/server'
|
55
|
+
require 'puree/model/temporal_range'
|
56
|
+
|
57
|
+
require 'puree/extractor/resource'
|
58
|
+
require 'puree/extractor/dataset'
|
59
|
+
require 'puree/extractor/event'
|
60
|
+
require 'puree/extractor/journal'
|
61
|
+
require 'puree/extractor/organisation'
|
62
|
+
require 'puree/extractor/person'
|
63
|
+
require 'puree/extractor/project'
|
64
|
+
require 'puree/extractor/publication'
|
65
|
+
require 'puree/extractor/publisher'
|
66
|
+
require 'puree/extractor/collection'
|
67
|
+
require 'puree/extractor/download'
|
68
|
+
require 'puree/extractor/server'
|
69
|
+
|
70
|
+
def config
|
71
|
+
{
|
72
|
+
url: ENV['PURE_URL'],
|
73
|
+
username: ENV['PURE_USERNAME'],
|
74
|
+
password: ENV['PURE_PASSWORD']
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def config_open
|
79
|
+
{
|
80
|
+
url: ENV['PURE_URL_OPEN']
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
def request(resource)
|
85
|
+
@extractor = Puree::Extractor::Collection.new config: config,
|
86
|
+
resource: resource
|
87
|
+
@p = @extractor.random_resource
|
88
|
+
end
|
89
|
+
|
90
|
+
def request_open(resource)
|
91
|
+
@extractor = Puree::Extractor::Collection.new resource: resource,
|
92
|
+
config: config_open
|
93
|
+
@p = @extractor.random_resource
|
94
|
+
end
|
95
|
+
|
96
|
+
def resource_header
|
97
|
+
it '#uuid' do
|
98
|
+
expect(@p.uuid).to be_a String if @p.uuid
|
99
|
+
end
|
100
|
+
|
101
|
+
it '#created' do
|
102
|
+
expect(@p.created).to be_a Time if @p.created
|
103
|
+
end
|
104
|
+
|
105
|
+
it '#modified' do
|
106
|
+
expect(@p.modified).to be_a Time if @p.modified
|
25
107
|
end
|
26
108
|
|
109
|
+
it '#locale' do
|
110
|
+
expect(@p.locale).to be_a String if @p.locale
|
111
|
+
end
|
27
112
|
end
|