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
data/spec/publisher_spec.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Publisher' 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_PUBLISHER_UUID']
|
10
|
-
@p = Puree::Publisher.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::Publisher.new
|
19
|
-
expect(p).to be_an_instance_of Puree::Publisher
|
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 '#locale' do
|
36
|
-
expect(@p.locale).to be_an_instance_of(String)
|
37
|
-
end
|
38
|
-
|
39
|
-
it '#metadata' do
|
40
|
-
expect(@p.metadata).to be_an_instance_of(Hash)
|
41
|
-
end
|
42
|
-
|
43
|
-
it '#metadata' do
|
44
|
-
expect(@p.metadata).not_to be_empty
|
45
|
-
end
|
46
|
-
|
47
|
-
it '#modified' do
|
48
|
-
expect(@p.modified).to be_an_instance_of(String)
|
49
|
-
end
|
50
|
-
|
51
|
-
it '#name' do
|
52
|
-
expect(@p.name).to be_an_instance_of(String)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Adds no value as value is Publisher
|
56
|
-
# it '#type' do
|
57
|
-
# expect(@p.type).to be_an_instance_of(String)
|
58
|
-
# end
|
59
|
-
|
60
|
-
it '#uuid' do
|
61
|
-
expect(@p.uuid).to be_an_instance_of(String)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'data retrieval from file' do
|
66
|
-
before(:all) do
|
67
|
-
request
|
68
|
-
|
69
|
-
filename = "#{ENV['PURE_FILE_PATH']}publisher.#{@uuid}.xml"
|
70
|
-
File.write(filename, @p.response.body)
|
71
|
-
|
72
|
-
@metadata = @p.set_content File.read(filename)
|
73
|
-
end
|
74
|
-
|
75
|
-
it '#set_content' do
|
76
|
-
expect(@metadata).to be_an_instance_of(Hash)
|
77
|
-
end
|
78
|
-
|
79
|
-
it '#metadata' do
|
80
|
-
expect(@p.metadata).to be_an_instance_of(Hash)
|
81
|
-
end
|
82
|
-
|
83
|
-
it '#metadata' do
|
84
|
-
expect(@p.metadata).not_to be_empty
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
data/spec/server_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Server' do
|
4
|
-
|
5
|
-
it '#new' do
|
6
|
-
p = Puree::Server.new
|
7
|
-
expect(p).to be_an_instance_of Puree::Server
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'data retrieval' do
|
11
|
-
before(:all) do
|
12
|
-
base_url = ENV['PURE_BASE_URL']
|
13
|
-
username = ENV['PURE_USERNAME']
|
14
|
-
password = ENV['PURE_PASSWORD']
|
15
|
-
@p = Puree::Server.new(base_url: base_url,
|
16
|
-
username: username,
|
17
|
-
password: password,
|
18
|
-
basic_auth: true)
|
19
|
-
@metadata = @p.find
|
20
|
-
end
|
21
|
-
|
22
|
-
it '#find' do
|
23
|
-
expect(@metadata).to be_an_instance_of(Hash)
|
24
|
-
end
|
25
|
-
|
26
|
-
it '#find' do
|
27
|
-
expect(@metadata).not_to be_empty
|
28
|
-
end
|
29
|
-
|
30
|
-
it '#version' do
|
31
|
-
expect(@p.version).to be_an_instance_of(String)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|