rif-cs 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rif-cs/activity.rb +1 -1
- data/lib/rif-cs/collection.rb +1 -1
- data/lib/rif-cs/party.rb +1 -2
- data/lib/rif-cs/service.rb +1 -1
- data/lib/rif-cs.rb +12 -0
- data/rif-cs.gemspec +4 -6
- data/spec/example_models.rb +906 -0
- data/spec/files/activity.xml +60 -58
- data/spec/files/collection.xml +72 -70
- data/spec/files/party.xml +62 -60
- data/spec/files/service.xml +64 -62
- data/spec/rif-cs_records.rb +23 -0
- data/spec/spec_helper.rb +1 -0
- metadata +15 -17
- data/spec/rif-cs_activity_spec.rb +0 -217
- data/spec/rif-cs_collection_spec.rb +0 -270
- data/spec/rif-cs_party_spec.rb +0 -228
- data/spec/rif-cs_service_spec.rb +0 -223
data/spec/rif-cs_party_spec.rb
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "RIFCS::Party" do
|
4
|
-
class PartyExample
|
5
|
-
require 'date'
|
6
|
-
include RIFCS::Party
|
7
|
-
|
8
|
-
attr_reader :party_key
|
9
|
-
|
10
|
-
def initialize(key='a key')
|
11
|
-
@party_key = key
|
12
|
-
end
|
13
|
-
|
14
|
-
def party_group
|
15
|
-
'test group'
|
16
|
-
end
|
17
|
-
|
18
|
-
def party_originating_source
|
19
|
-
'tomato'
|
20
|
-
end
|
21
|
-
|
22
|
-
def party_type
|
23
|
-
'person'
|
24
|
-
end
|
25
|
-
|
26
|
-
def party_date_modified
|
27
|
-
Time.new(2012, 6, 14).utc
|
28
|
-
end
|
29
|
-
|
30
|
-
def party_identifiers
|
31
|
-
[
|
32
|
-
{ value: 'http://example.com', type: 'uri' },
|
33
|
-
{ value: '123', type: 'local' }
|
34
|
-
]
|
35
|
-
end
|
36
|
-
|
37
|
-
def party_names
|
38
|
-
[
|
39
|
-
{
|
40
|
-
type: 'primary',
|
41
|
-
name_parts: [
|
42
|
-
{ type: 'title', value: 'Dr' },
|
43
|
-
{ type: 'given', value: 'John' },
|
44
|
-
{ type: 'family', value: 'Doe' }
|
45
|
-
]
|
46
|
-
},
|
47
|
-
]
|
48
|
-
end
|
49
|
-
|
50
|
-
def party_related_info
|
51
|
-
[
|
52
|
-
{
|
53
|
-
type: 'website',
|
54
|
-
identifier: {
|
55
|
-
value: 'http://example.com/personalsites/foo',
|
56
|
-
type: 'uri'
|
57
|
-
},
|
58
|
-
title: 'This person\'s blog',
|
59
|
-
notes: 'Another blog'
|
60
|
-
},
|
61
|
-
{
|
62
|
-
type: 'publication',
|
63
|
-
identifier: {
|
64
|
-
value: '111',
|
65
|
-
type: 'isbn'
|
66
|
-
},
|
67
|
-
title: 'The Ordering of Things',
|
68
|
-
notes: 'Not available'
|
69
|
-
}
|
70
|
-
]
|
71
|
-
end
|
72
|
-
|
73
|
-
def party_related_objects
|
74
|
-
{
|
75
|
-
has_association_with: [
|
76
|
-
{
|
77
|
-
key: 'b party',
|
78
|
-
relation: {
|
79
|
-
description: 'Supervisor'
|
80
|
-
}
|
81
|
-
}
|
82
|
-
],
|
83
|
-
is_member_of: [
|
84
|
-
{
|
85
|
-
key: 'some group'
|
86
|
-
}
|
87
|
-
]
|
88
|
-
}
|
89
|
-
end
|
90
|
-
|
91
|
-
def party_locations
|
92
|
-
[
|
93
|
-
{
|
94
|
-
date_from: Time.new(2012, 6, 14).utc,
|
95
|
-
addresses: [
|
96
|
-
{
|
97
|
-
electronic: [
|
98
|
-
{
|
99
|
-
type: 'email',
|
100
|
-
value: 'joe@example.com'
|
101
|
-
},
|
102
|
-
{
|
103
|
-
type: 'uri',
|
104
|
-
value: "http://example.com/people/#{@party_key}",
|
105
|
-
args: [
|
106
|
-
{ value: 'placeholder', required: 'false' }
|
107
|
-
]
|
108
|
-
}
|
109
|
-
],
|
110
|
-
physical: [
|
111
|
-
{
|
112
|
-
type: 'postalAddress',
|
113
|
-
address_parts: [
|
114
|
-
{
|
115
|
-
type: 'country',
|
116
|
-
value: 'Austrlia'
|
117
|
-
},
|
118
|
-
]
|
119
|
-
},
|
120
|
-
{
|
121
|
-
address_parts: [
|
122
|
-
{
|
123
|
-
type: 'telephoneNumber',
|
124
|
-
value: '+61 2 9123 4567'
|
125
|
-
}
|
126
|
-
]
|
127
|
-
}
|
128
|
-
]
|
129
|
-
}
|
130
|
-
]
|
131
|
-
}
|
132
|
-
]
|
133
|
-
end
|
134
|
-
|
135
|
-
def party_coverage
|
136
|
-
[
|
137
|
-
{
|
138
|
-
spatials: [
|
139
|
-
{
|
140
|
-
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
141
|
-
type: 'gml'
|
142
|
-
}
|
143
|
-
],
|
144
|
-
temporals: [
|
145
|
-
{
|
146
|
-
dates: [
|
147
|
-
{
|
148
|
-
value: Time.new(2012, 6, 14).utc,
|
149
|
-
date_format: 'UTC',
|
150
|
-
type: 'dateFrom'
|
151
|
-
},
|
152
|
-
{
|
153
|
-
value: Time.new(2013, 6, 14).utc,
|
154
|
-
date_format: 'UTC',
|
155
|
-
type: 'dateTo'
|
156
|
-
},
|
157
|
-
],
|
158
|
-
text: ['Self destructs in 1 year']
|
159
|
-
}
|
160
|
-
]
|
161
|
-
}
|
162
|
-
]
|
163
|
-
end
|
164
|
-
|
165
|
-
def party_descriptions
|
166
|
-
[
|
167
|
-
{
|
168
|
-
value: 'A researcher',
|
169
|
-
type: 'brief',
|
170
|
-
'xmllang' => nil
|
171
|
-
},
|
172
|
-
{
|
173
|
-
value: 'Not just any researcher',
|
174
|
-
type: 'full'
|
175
|
-
}
|
176
|
-
]
|
177
|
-
end
|
178
|
-
|
179
|
-
def party_existence_dates
|
180
|
-
[
|
181
|
-
{
|
182
|
-
start_date: {
|
183
|
-
value: Time.new(2012, 6, 14).utc,
|
184
|
-
date_format: 'UTC'
|
185
|
-
},
|
186
|
-
end_date: {
|
187
|
-
}
|
188
|
-
}
|
189
|
-
]
|
190
|
-
end
|
191
|
-
|
192
|
-
def party_rights
|
193
|
-
[
|
194
|
-
{
|
195
|
-
rights_statement: {
|
196
|
-
rights_uri: 'http://www.intersect.org.au/policies',
|
197
|
-
value: 'Copyright 2012 Intersect Australia Ltd.'
|
198
|
-
},
|
199
|
-
licence: {
|
200
|
-
value: 'Attribution (CC BY)',
|
201
|
-
rights_uri: 'http://creativecommons.org/licenses/by/3.0',
|
202
|
-
type: ''
|
203
|
-
},
|
204
|
-
access_rights: {
|
205
|
-
value: 'Available to all without restriction'
|
206
|
-
}
|
207
|
-
}
|
208
|
-
]
|
209
|
-
end
|
210
|
-
|
211
|
-
def party_subjects
|
212
|
-
[
|
213
|
-
{
|
214
|
-
value: '123456',
|
215
|
-
type: 'anzsrc-for'
|
216
|
-
}
|
217
|
-
]
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
it "should give a RIF-CS XML Party record for a model" do
|
223
|
-
expected = IO.read(File.join(File.dirname(__FILE__), 'files', 'party.xml'))
|
224
|
-
party = PartyExample.new
|
225
|
-
party.to_rifcs.to_xml.should eq(expected)
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
data/spec/rif-cs_service_spec.rb
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
describe "RIFCS::Service" do
|
3
|
-
|
4
|
-
class ServiceExample
|
5
|
-
include RIFCS::Service
|
6
|
-
|
7
|
-
attr_reader :service_key, :service_group
|
8
|
-
|
9
|
-
def initialize(key, group='Intersect Australia')
|
10
|
-
@service_key = key || 'service key'
|
11
|
-
@service_group = group
|
12
|
-
end
|
13
|
-
|
14
|
-
def service_originating_source
|
15
|
-
'http://www.intersect.org.au'
|
16
|
-
end
|
17
|
-
|
18
|
-
def service_root
|
19
|
-
{
|
20
|
-
date_modified: Time.new(2012, 6, 14).utc,
|
21
|
-
type: 'create'
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
def service_identifiers
|
26
|
-
[
|
27
|
-
{
|
28
|
-
type: 'local',
|
29
|
-
value: 'hdl:1959.4/004_311'
|
30
|
-
}
|
31
|
-
]
|
32
|
-
end
|
33
|
-
|
34
|
-
def service_names
|
35
|
-
[
|
36
|
-
{
|
37
|
-
:date_from => Time.new(2012, 6, 14),
|
38
|
-
:date_to => Time.new(2013, 6, 14),
|
39
|
-
:type => 'create',
|
40
|
-
:name_parts => [
|
41
|
-
{
|
42
|
-
:type => nil,
|
43
|
-
:value => 'Autolab PGSTAT 12 Potentiostat'
|
44
|
-
}
|
45
|
-
]
|
46
|
-
}
|
47
|
-
]
|
48
|
-
end
|
49
|
-
|
50
|
-
def service_locations
|
51
|
-
[
|
52
|
-
{
|
53
|
-
addresses: [
|
54
|
-
{
|
55
|
-
electronic: [
|
56
|
-
{
|
57
|
-
type: 'email',
|
58
|
-
value: 'joe@example.com'
|
59
|
-
},
|
60
|
-
],
|
61
|
-
physical: [
|
62
|
-
{
|
63
|
-
type: 'postalAddress',
|
64
|
-
address_parts: [
|
65
|
-
{
|
66
|
-
type: 'country',
|
67
|
-
value: 'Austrlia'
|
68
|
-
},
|
69
|
-
]
|
70
|
-
},
|
71
|
-
{
|
72
|
-
address_parts: [
|
73
|
-
{
|
74
|
-
type: 'telephoneNumber',
|
75
|
-
value: '+61 2 9123 4567'
|
76
|
-
}
|
77
|
-
]
|
78
|
-
}
|
79
|
-
]
|
80
|
-
}
|
81
|
-
],
|
82
|
-
spatials: [
|
83
|
-
{
|
84
|
-
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
85
|
-
type: 'gml'
|
86
|
-
}
|
87
|
-
]
|
88
|
-
}
|
89
|
-
]
|
90
|
-
end
|
91
|
-
|
92
|
-
def service_coverage
|
93
|
-
[
|
94
|
-
{
|
95
|
-
spatials: [
|
96
|
-
{
|
97
|
-
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
98
|
-
type: 'gml'
|
99
|
-
}
|
100
|
-
],
|
101
|
-
temporals: [
|
102
|
-
{
|
103
|
-
dates: [
|
104
|
-
{
|
105
|
-
value: Time.new(2012,6,14).utc,
|
106
|
-
date_format: 'UTC',
|
107
|
-
type: 'dateFrom'
|
108
|
-
},
|
109
|
-
{
|
110
|
-
value: Time.new(2013,6,14).utc,
|
111
|
-
date_format: 'UTC',
|
112
|
-
type: 'dateTo'
|
113
|
-
},
|
114
|
-
],
|
115
|
-
text: ['Self destructs in 1 year']
|
116
|
-
}
|
117
|
-
]
|
118
|
-
}
|
119
|
-
]
|
120
|
-
end
|
121
|
-
|
122
|
-
def service_related_objects
|
123
|
-
{
|
124
|
-
has_association_with: [
|
125
|
-
{
|
126
|
-
key: 'http://nla.gov.au/nla.party-593921',
|
127
|
-
}
|
128
|
-
],
|
129
|
-
is_presented_by: [
|
130
|
-
{
|
131
|
-
key: 'some group'
|
132
|
-
}
|
133
|
-
]
|
134
|
-
}
|
135
|
-
end
|
136
|
-
|
137
|
-
def service_subjects
|
138
|
-
[
|
139
|
-
]
|
140
|
-
end
|
141
|
-
|
142
|
-
def service_descriptions
|
143
|
-
[
|
144
|
-
{
|
145
|
-
type: 'deliverymethod',
|
146
|
-
value: 'offline'
|
147
|
-
},
|
148
|
-
{
|
149
|
-
type: 'full',
|
150
|
-
value: 'General-purpose potentiostat.'
|
151
|
-
}
|
152
|
-
]
|
153
|
-
end
|
154
|
-
|
155
|
-
def service_access_policies
|
156
|
-
[
|
157
|
-
{ value: 'http://example.com/policy' }
|
158
|
-
]
|
159
|
-
end
|
160
|
-
|
161
|
-
def service_rights
|
162
|
-
[
|
163
|
-
{
|
164
|
-
rights_statement: {
|
165
|
-
rights_uri: 'http://www.intersect.org.au/policies',
|
166
|
-
value: 'Copyright 2012 Intersect Australia Ltd.'
|
167
|
-
},
|
168
|
-
licence: {
|
169
|
-
value: 'Attribution (CC BY)',
|
170
|
-
rights_uri: 'http://creativecommons.org/licenses/by/3.0',
|
171
|
-
type: ''
|
172
|
-
},
|
173
|
-
access_rights: {
|
174
|
-
value: 'Available to all without restriction'
|
175
|
-
}
|
176
|
-
}
|
177
|
-
]
|
178
|
-
end
|
179
|
-
|
180
|
-
def service_existence_dates
|
181
|
-
[
|
182
|
-
{
|
183
|
-
start_date: {
|
184
|
-
value: Time.new(2012, 6, 14).utc,
|
185
|
-
date_format: 'UTC'
|
186
|
-
},
|
187
|
-
end_date: {
|
188
|
-
}
|
189
|
-
}
|
190
|
-
]
|
191
|
-
end
|
192
|
-
|
193
|
-
def service_related_info
|
194
|
-
[
|
195
|
-
{
|
196
|
-
type: 'website',
|
197
|
-
identifier: {
|
198
|
-
value: 'http://example.com/personalsites/foo',
|
199
|
-
type: 'uri'
|
200
|
-
},
|
201
|
-
title: 'This person\'s blog',
|
202
|
-
notes: 'Another blog'
|
203
|
-
},
|
204
|
-
{
|
205
|
-
type: 'publication',
|
206
|
-
identifier: {
|
207
|
-
value: '111',
|
208
|
-
type: 'isbn'
|
209
|
-
},
|
210
|
-
title: 'The Ordering of Things',
|
211
|
-
notes: 'Not available'
|
212
|
-
}
|
213
|
-
]
|
214
|
-
end
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
it "should give a RIF-CS XML Service record for a model" do
|
219
|
-
expected = IO.read(File.join(File.dirname(__FILE__), 'files', 'service.xml'))
|
220
|
-
service = ServiceExample.new(nil)
|
221
|
-
service.to_rifcs.to_xml.should eq(expected)
|
222
|
-
end
|
223
|
-
end
|