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/lib/puree/server.rb
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
module Puree
|
2
|
-
|
3
|
-
# Server
|
4
|
-
#
|
5
|
-
class Server
|
6
|
-
|
7
|
-
attr_reader :response
|
8
|
-
|
9
|
-
# @param base_url [String]
|
10
|
-
# @param username [String]
|
11
|
-
# @param password [String]
|
12
|
-
# @param basic_auth [Boolean]
|
13
|
-
def initialize(base_url: nil,
|
14
|
-
username: nil,
|
15
|
-
password: nil,
|
16
|
-
basic_auth: nil)
|
17
|
-
@resource_type = :server
|
18
|
-
@api_map = Puree::Map.new.get
|
19
|
-
@base_url = base_url.nil? ? Puree.base_url : base_url
|
20
|
-
@basic_auth = basic_auth.nil? ? Puree.basic_auth : basic_auth
|
21
|
-
if @basic_auth === true
|
22
|
-
@username = username.nil? ? Puree.username : username
|
23
|
-
@password = password.nil? ? Puree.password : password
|
24
|
-
end
|
25
|
-
@metadata = {}
|
26
|
-
end
|
27
|
-
|
28
|
-
# Get
|
29
|
-
#
|
30
|
-
# @return [Hash]
|
31
|
-
def get
|
32
|
-
missing = missing_credentials
|
33
|
-
if !missing.empty?
|
34
|
-
missing.each do |m|
|
35
|
-
puts "#{self.class.name}" + '#' + "#{__method__} missing #{m}"
|
36
|
-
end
|
37
|
-
exit
|
38
|
-
end
|
39
|
-
|
40
|
-
# strip any trailing slash
|
41
|
-
@base_url = @base_url.sub(/(\/)+$/, '')
|
42
|
-
@auth = Base64::strict_encode64(@username + ':' + @password)
|
43
|
-
|
44
|
-
@options = {
|
45
|
-
basic_auth: @basic_auth,
|
46
|
-
latest_api: true,
|
47
|
-
resource_type: @resource_type.to_sym,
|
48
|
-
rendering: :system,
|
49
|
-
}
|
50
|
-
headers = {
|
51
|
-
'Accept' => 'application/xml',
|
52
|
-
'Authorization' => 'Basic ' + @auth
|
53
|
-
}
|
54
|
-
query = {}
|
55
|
-
query['rendering'] = @options[:rendering]
|
56
|
-
|
57
|
-
begin
|
58
|
-
url = build_url
|
59
|
-
req = HTTP.headers accept: headers['Accept']
|
60
|
-
if @options[:basic_auth]
|
61
|
-
req = req.auth headers['Authorization']
|
62
|
-
end
|
63
|
-
@response = req.get(url, params: query)
|
64
|
-
@doc = Nokogiri::XML @response.body
|
65
|
-
@doc.remove_namespaces!
|
66
|
-
rescue HTTP::Error => e
|
67
|
-
puts 'HTTP::Error '+ e.message
|
68
|
-
end
|
69
|
-
|
70
|
-
get_data? ? combine_metadata : {}
|
71
|
-
end
|
72
|
-
|
73
|
-
# All metadata
|
74
|
-
#
|
75
|
-
# @return [Hash]
|
76
|
-
def metadata
|
77
|
-
@metadata
|
78
|
-
end
|
79
|
-
|
80
|
-
# Version
|
81
|
-
#
|
82
|
-
# @return [String]
|
83
|
-
def version
|
84
|
-
@metadata['version']
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def combine_metadata
|
90
|
-
o = {}
|
91
|
-
o['version'] = extract_version
|
92
|
-
@metadata = o
|
93
|
-
end
|
94
|
-
|
95
|
-
def extract_version
|
96
|
-
path = service_response_name + '/baseVersion'
|
97
|
-
xpath_query(path).text.strip
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
# Is there any data after get?
|
102
|
-
#
|
103
|
-
# @return [Boolean]
|
104
|
-
def get_data?
|
105
|
-
# n.b. arbitrary element existence check
|
106
|
-
path = service_response_name + '/baseVersion'
|
107
|
-
xpath_result = @doc.xpath path
|
108
|
-
xpath_result.size ? true : false
|
109
|
-
end
|
110
|
-
|
111
|
-
def service_name
|
112
|
-
resource_type = @options[:resource_type]
|
113
|
-
@api_map[:resource_type][resource_type][:service]
|
114
|
-
end
|
115
|
-
|
116
|
-
def service_response_name
|
117
|
-
resource_type = @options[:resource_type]
|
118
|
-
@api_map[:resource_type][resource_type][:response]
|
119
|
-
end
|
120
|
-
|
121
|
-
def build_url
|
122
|
-
service = service_name
|
123
|
-
if @options[:latest_api] === false
|
124
|
-
service_api_mode = service
|
125
|
-
else
|
126
|
-
service_api_mode = service + '.current'
|
127
|
-
end
|
128
|
-
@base_url + '/' + service_api_mode
|
129
|
-
end
|
130
|
-
|
131
|
-
def xpath_query(path)
|
132
|
-
xml = @response.body
|
133
|
-
doc = Nokogiri::XML xml
|
134
|
-
doc.remove_namespaces!
|
135
|
-
doc.xpath path
|
136
|
-
end
|
137
|
-
|
138
|
-
def missing_credentials
|
139
|
-
missing = []
|
140
|
-
if @base_url.nil?
|
141
|
-
missing << 'base_url'
|
142
|
-
end
|
143
|
-
if @username.nil?
|
144
|
-
missing << 'username'
|
145
|
-
end
|
146
|
-
if @password.nil?
|
147
|
-
missing << 'password'
|
148
|
-
end
|
149
|
-
missing
|
150
|
-
end
|
151
|
-
|
152
|
-
alias :find :get
|
153
|
-
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
data/spec/collection_spec.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Collection' do
|
4
|
-
|
5
|
-
def new
|
6
|
-
base_url = ENV['PURE_BASE_URL']
|
7
|
-
username = ENV['PURE_USERNAME']
|
8
|
-
password = ENV['PURE_PASSWORD']
|
9
|
-
@p = Puree::Collection.new(resource: :dataset,
|
10
|
-
base_url: base_url,
|
11
|
-
username: username,
|
12
|
-
password: password,
|
13
|
-
basic_auth: true)
|
14
|
-
end
|
15
|
-
|
16
|
-
it '#new' do
|
17
|
-
new
|
18
|
-
expect(@p).to be_an_instance_of(Puree::Collection)
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'data retrieval' do
|
22
|
-
before(:all) do
|
23
|
-
new
|
24
|
-
@metadata = @p.find limit: 5
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'collection' do
|
28
|
-
expect(@metadata).to be_an_instance_of(Array)
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'data retrieval instance' do
|
34
|
-
before(:all) do
|
35
|
-
new
|
36
|
-
@metadata = @p.find limit: 5,
|
37
|
-
instance: true
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'collection' do
|
41
|
-
expect(@metadata).to be_an_instance_of(Array)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'collection item' do
|
45
|
-
expect(@metadata[0]).to be_an_instance_of(Puree::Dataset)
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'data retrieval count' do
|
51
|
-
before(:all) do
|
52
|
-
new
|
53
|
-
@p.find limit: 0
|
54
|
-
end
|
55
|
-
|
56
|
-
it '#count' do
|
57
|
-
expect(@p.count).to be_an_instance_of(Fixnum)
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/spec/dataset_spec.rb
DELETED
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Dataset' 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_DATASET_UUID']
|
10
|
-
@p = Puree::Dataset.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::Dataset.new
|
19
|
-
expect(p).to be_an_instance_of Puree::Dataset
|
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 '#access' do
|
32
|
-
expect(@p.access).to be_an_instance_of(String)
|
33
|
-
end
|
34
|
-
|
35
|
-
it '#associated' do
|
36
|
-
expect(@p.associated).to be_an_instance_of(Array)
|
37
|
-
end
|
38
|
-
|
39
|
-
it '#available' do
|
40
|
-
expect(@p.available).to be_an_instance_of(Hash)
|
41
|
-
end
|
42
|
-
|
43
|
-
it '#created' do
|
44
|
-
expect(@p.created).to be_an_instance_of(String)
|
45
|
-
end
|
46
|
-
|
47
|
-
it '#description' do
|
48
|
-
expect(@p.description).to be_an_instance_of(String)
|
49
|
-
end
|
50
|
-
|
51
|
-
it '#doi' do
|
52
|
-
expect(@p.doi).to be_an_instance_of(String)
|
53
|
-
end
|
54
|
-
|
55
|
-
it '#file' do
|
56
|
-
expect(@p.file).to be_an_instance_of(Array)
|
57
|
-
end
|
58
|
-
|
59
|
-
it '#keyword' do
|
60
|
-
expect(@p.keyword).to be_an_instance_of(Array)
|
61
|
-
end
|
62
|
-
|
63
|
-
it '#link' do
|
64
|
-
expect(@p.link).to be_an_instance_of(Array)
|
65
|
-
end
|
66
|
-
|
67
|
-
it '#locale' do
|
68
|
-
expect(@p.locale).to be_an_instance_of(String)
|
69
|
-
end
|
70
|
-
|
71
|
-
it '#metadata' do
|
72
|
-
expect(@p.metadata).to be_an_instance_of(Hash)
|
73
|
-
end
|
74
|
-
|
75
|
-
it '#metadata' do
|
76
|
-
expect(@p.metadata).not_to be_empty
|
77
|
-
end
|
78
|
-
|
79
|
-
it '#modified' do
|
80
|
-
expect(@p.modified).to be_an_instance_of(String)
|
81
|
-
end
|
82
|
-
|
83
|
-
it '#person' do
|
84
|
-
expect(@p.person).to be_an_instance_of(Hash)
|
85
|
-
end
|
86
|
-
|
87
|
-
it '#production' do
|
88
|
-
expect(@p.production).to be_an_instance_of(Hash)
|
89
|
-
end
|
90
|
-
|
91
|
-
it '#project' do
|
92
|
-
expect(@p.project).to be_an_instance_of(Array)
|
93
|
-
end
|
94
|
-
|
95
|
-
it '#publication' do
|
96
|
-
expect(@p.publication).to be_an_instance_of(Array)
|
97
|
-
end
|
98
|
-
|
99
|
-
it '#publisher' do
|
100
|
-
expect(@p.publisher).to be_an_instance_of(String)
|
101
|
-
end
|
102
|
-
|
103
|
-
it '#spatial' do
|
104
|
-
expect(@p.spatial).to be_an_instance_of(Array)
|
105
|
-
end
|
106
|
-
|
107
|
-
it '#spatial_point' do
|
108
|
-
expect(@p.spatial_point).to be_an_instance_of(Hash)
|
109
|
-
end
|
110
|
-
|
111
|
-
it '#temporal' do
|
112
|
-
expect(@p.temporal).to be_an_instance_of(Hash)
|
113
|
-
end
|
114
|
-
|
115
|
-
it '#title' do
|
116
|
-
expect(@p.title).to be_an_instance_of(String)
|
117
|
-
end
|
118
|
-
|
119
|
-
it '#uuid' do
|
120
|
-
expect(@p.uuid).to be_an_instance_of(String)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe 'data retrieval from file' do
|
125
|
-
before(:all) do
|
126
|
-
request
|
127
|
-
|
128
|
-
filename = "#{ENV['PURE_FILE_PATH']}dataset.#{@uuid}.xml"
|
129
|
-
File.write(filename, @p.response.body)
|
130
|
-
|
131
|
-
@metadata = @p.set_content File.read(filename)
|
132
|
-
end
|
133
|
-
|
134
|
-
it '#set_content' do
|
135
|
-
expect(@metadata).to be_an_instance_of(Hash)
|
136
|
-
end
|
137
|
-
|
138
|
-
it '#metadata' do
|
139
|
-
expect(@p.metadata).to be_an_instance_of(Hash)
|
140
|
-
end
|
141
|
-
|
142
|
-
it '#metadata' do
|
143
|
-
expect(@p.metadata).not_to be_empty
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
end
|
data/spec/download_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Download' do
|
4
|
-
|
5
|
-
it '#new' do
|
6
|
-
p = Puree::Download.new
|
7
|
-
expect(p).to be_an_instance_of Puree::Download
|
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::Download.new(base_url: base_url,
|
16
|
-
username: username,
|
17
|
-
password: password,
|
18
|
-
basic_auth: true)
|
19
|
-
@metadata = @p.find resource: :dataset,
|
20
|
-
limit: 10
|
21
|
-
end
|
22
|
-
|
23
|
-
it '#find' do
|
24
|
-
expect(@metadata).to be_an_instance_of(Array)
|
25
|
-
end
|
26
|
-
|
27
|
-
it '#find' do
|
28
|
-
expect(@metadata).not_to be_empty
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
data/spec/event_spec.rb
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Event' 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_EVENT_UUID']
|
10
|
-
@p = Puree::Event.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::Event.new
|
19
|
-
expect(p).to be_an_instance_of Puree::Event
|
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 '#city' do
|
32
|
-
expect(@p.city).to be_an_instance_of(String)
|
33
|
-
end
|
34
|
-
|
35
|
-
it '#country' do
|
36
|
-
expect(@p.country).to be_an_instance_of(String)
|
37
|
-
end
|
38
|
-
|
39
|
-
it '#created' do
|
40
|
-
expect(@p.created).to be_an_instance_of(String)
|
41
|
-
end
|
42
|
-
|
43
|
-
it '#date' do
|
44
|
-
expect(@p.date).to be_an_instance_of(Hash)
|
45
|
-
end
|
46
|
-
|
47
|
-
it '#description' do
|
48
|
-
expect(@p.description).to be_an_instance_of(String)
|
49
|
-
end
|
50
|
-
|
51
|
-
it '#location' do
|
52
|
-
expect(@p.location).to be_an_instance_of(String)
|
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 '#title' do
|
72
|
-
expect(@p.title).to be_an_instance_of(String)
|
73
|
-
end
|
74
|
-
|
75
|
-
it '#type' do
|
76
|
-
expect(@p.type).to be_an_instance_of(String)
|
77
|
-
end
|
78
|
-
|
79
|
-
it '#uuid' do
|
80
|
-
expect(@p.uuid).to be_an_instance_of(String)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
describe 'data retrieval from file' do
|
85
|
-
before(:all) do
|
86
|
-
request
|
87
|
-
|
88
|
-
filename = "#{ENV['PURE_FILE_PATH']}event.#{@uuid}.xml"
|
89
|
-
File.write(filename, @p.response.body)
|
90
|
-
|
91
|
-
@metadata = @p.set_content File.read(filename)
|
92
|
-
end
|
93
|
-
|
94
|
-
it '#set_content' do
|
95
|
-
expect(@metadata).to be_an_instance_of(Hash)
|
96
|
-
end
|
97
|
-
|
98
|
-
it '#metadata' do
|
99
|
-
expect(@p.metadata).to be_an_instance_of(Hash)
|
100
|
-
end
|
101
|
-
|
102
|
-
it '#metadata' do
|
103
|
-
expect(@p.metadata).not_to be_empty
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|