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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rif-cs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-25 00:00:00.000000000 Z
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &86099340 !ruby/object:Gem::Requirement
16
+ requirement: &80962300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *86099340
24
+ version_requirements: *80962300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &86099100 !ruby/object:Gem::Requirement
27
+ requirement: &80962040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *86099100
35
+ version_requirements: *80962040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &86098850 !ruby/object:Gem::Requirement
38
+ requirement: &80961800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *86098850
46
+ version_requirements: *80961800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &86098610 !ruby/object:Gem::Requirement
49
+ requirement: &80961540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *86098610
57
+ version_requirements: *80961540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &86098330 !ruby/object:Gem::Requirement
60
+ requirement: &80961280 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 1.8.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *86098330
68
+ version_requirements: *80961280
69
69
  description: Instrument your class to return RIF-CS
70
70
  email: sean@intersect.org.au
71
71
  executables: []
@@ -88,14 +88,12 @@ files:
88
88
  - lib/rif-cs/party.rb
89
89
  - lib/rif-cs/service.rb
90
90
  - rif-cs.gemspec
91
+ - spec/example_models.rb
91
92
  - spec/files/activity.xml
92
93
  - spec/files/collection.xml
93
94
  - spec/files/party.xml
94
95
  - spec/files/service.xml
95
- - spec/rif-cs_activity_spec.rb
96
- - spec/rif-cs_collection_spec.rb
97
- - spec/rif-cs_party_spec.rb
98
- - spec/rif-cs_service_spec.rb
96
+ - spec/rif-cs_records.rb
99
97
  - spec/rif-cs_spec.rb
100
98
  - spec/spec_helper.rb
101
99
  homepage: http://github.com/IntersectAustralia/ruby_rif-cs
@@ -113,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
111
  version: '0'
114
112
  segments:
115
113
  - 0
116
- hash: 658979533
114
+ hash: 892782927
117
115
  required_rubygems_version: !ruby/object:Gem::Requirement
118
116
  none: false
119
117
  requirements:
@@ -1,217 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "RIFCS::Activity" do
4
- class ActivityExample
5
- require 'date'
6
- include RIFCS::Activity
7
-
8
- attr_reader :activity_key
9
-
10
- def initialize(key='a key')
11
- @activity_key = key
12
- end
13
-
14
- def activity_group
15
- 'test group'
16
- end
17
-
18
- def activity_originating_source
19
- 'tomato'
20
- end
21
-
22
- def activity_type
23
- 'program'
24
- end
25
-
26
- def activity_date_modified
27
- Time.new(2012, 6, 14).utc
28
- end
29
-
30
- def activity_identifiers
31
- [
32
- { value: 'http://example.com', type: 'uri' },
33
- { value: '123', type: 'local' }
34
- ]
35
- end
36
-
37
- def activity_names
38
- [
39
- {
40
- type: 'primary',
41
- name_parts: [
42
- { value: 'Testing of software' },
43
- ]
44
- },
45
- ]
46
- end
47
-
48
- def activity_related_info
49
- [
50
- {
51
- type: 'publication',
52
- identifier: {
53
- value: '111',
54
- type: 'isbn'
55
- },
56
- title: 'The Ordering of Things',
57
- notes: 'Not available'
58
- }
59
- ]
60
- end
61
-
62
- def activity_related_objects
63
- {
64
- has_association_with: [
65
- {
66
- key: 'b party',
67
- relation: {
68
- description: 'Supervisor'
69
- }
70
- }
71
- ],
72
- is_member_of: [
73
- {
74
- key: 'some group'
75
- }
76
- ]
77
- }
78
- end
79
-
80
- def activity_locations
81
- [
82
- {
83
- date_from: Time.new(2012, 6, 14).utc,
84
- addresses: [
85
- {
86
- electronic: [
87
- {
88
- type: 'email',
89
- value: 'joe@example.com'
90
- },
91
- {
92
- type: 'uri',
93
- value: "http://example.com/people/#{@activity_key}",
94
- args: [
95
- { value: 'placeholder', required: 'false' }
96
- ]
97
- }
98
- ],
99
- physical: [
100
- {
101
- type: 'postalAddress',
102
- address_parts: [
103
- {
104
- type: 'country',
105
- value: 'Austrlia'
106
- },
107
- ]
108
- },
109
- {
110
- address_parts: [
111
- {
112
- type: 'telephoneNumber',
113
- value: '+61 2 9123 4567'
114
- }
115
- ]
116
- }
117
- ]
118
- }
119
- ]
120
- }
121
- ]
122
- end
123
-
124
- def activity_coverage
125
- [
126
- {
127
- spatials: [
128
- {
129
- value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
130
- type: 'gml'
131
- }
132
- ],
133
- temporals: [
134
- {
135
- dates: [
136
- {
137
- value: Time.new(2012, 6, 14).utc,
138
- date_format: 'UTC',
139
- type: 'dateFrom'
140
- },
141
- {
142
- value: Time.new(2013, 6, 14).utc,
143
- date_format: 'UTC',
144
- type: 'dateTo'
145
- },
146
- ],
147
- text: ['Self destructs in 1 year']
148
- }
149
- ]
150
- }
151
- ]
152
- end
153
-
154
- def activity_descriptions
155
- [
156
- {
157
- value: 'An activity',
158
- type: 'brief',
159
- 'xmllang' => nil
160
- },
161
- {
162
- value: 'Not just any activity',
163
- type: 'full'
164
- }
165
- ]
166
- end
167
-
168
- def activity_existence_dates
169
- [
170
- {
171
- start_date: {
172
- value: Time.new(2012, 6, 14).utc,
173
- date_format: 'UTC'
174
- },
175
- end_date: {
176
- }
177
- }
178
- ]
179
- end
180
-
181
- def activity_rights
182
- [
183
- {
184
- rights_statement: {
185
- rights_uri: 'http://www.intersect.org.au/policies',
186
- value: 'Copyright 2012 Intersect Australia Ltd.'
187
- },
188
- licence: {
189
- value: 'Attribution (CC BY)',
190
- rights_uri: 'http://creativecommons.org/licenses/by/3.0',
191
- type: ''
192
- },
193
- access_rights: {
194
- value: 'Available to all without restriction'
195
- }
196
- }
197
- ]
198
- end
199
-
200
- def activity_subjects
201
- [
202
- {
203
- value: '123456',
204
- type: 'anzsrc-for'
205
- }
206
- ]
207
- end
208
-
209
- end
210
-
211
- it "should give a RIF-CS XML Activity record for a model" do
212
- expected = IO.read(File.join(File.dirname(__FILE__), 'files', 'activity.xml'))
213
- activity = ActivityExample.new
214
- activity.to_rifcs.to_xml.should eq(expected)
215
- end
216
-
217
- end
@@ -1,270 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "RIFCS::Collection" do
4
- class CollectionExample
5
- require 'date'
6
- include RIFCS::Collection
7
-
8
- attr_reader :collection_key
9
-
10
- def initialize(key='a key')
11
- @collection_key = key
12
- end
13
-
14
- def collection_date_accessioned
15
- Time.new(2012, 6, 14).utc
16
- end
17
-
18
- def collection_group
19
- 'test group'
20
- end
21
-
22
- def collection_originating_source
23
- 'tomato'
24
- end
25
-
26
- def collection_type
27
- 'dataset'
28
- end
29
-
30
- def collection_date_modified
31
- Time.new(2012, 6, 14).utc
32
- end
33
-
34
- def collection_identifiers
35
- [
36
- { value: 'http://example.com', type: 'uri' },
37
- { value: '123', type: 'local' }
38
- ]
39
- end
40
-
41
- def collection_names
42
- [
43
- {
44
- type: 'primary',
45
- name_parts: [
46
- { type: 'title', value: 'Dr' },
47
- { type: 'given', value: 'John' },
48
- { type: 'family', value: 'Doe' }
49
- ]
50
- },
51
- ]
52
- end
53
-
54
- def collection_related_info
55
- [
56
- {
57
- type: 'website',
58
- identifier: {
59
- value: 'http://example.com/personalsites/foo',
60
- type: 'uri'
61
- },
62
- title: 'This person\'s blog',
63
- notes: 'Another blog'
64
- },
65
- {
66
- type: 'publication',
67
- identifier: {
68
- value: '111',
69
- type: 'isbn'
70
- },
71
- title: 'The Ordering of Things',
72
- notes: 'Not available'
73
- }
74
- ]
75
- end
76
-
77
- def collection_related_objects
78
- {
79
- has_association_with: [
80
- {
81
- key: 'b party',
82
- relation: {
83
- description: 'owner'
84
- }
85
- }
86
- ],
87
- is_member_of: [
88
- {
89
- key: 'some group'
90
- }
91
- ]
92
- }
93
- end
94
-
95
- def collection_locations
96
- [
97
- {
98
- date_from: Time.new(2012, 6, 14).utc,
99
- addresses: [
100
- {
101
- electronic: [
102
- {
103
- type: 'email',
104
- value: 'joe@example.com'
105
- },
106
- {
107
- type: 'uri',
108
- value: "http://example.com/people/#{@collection_key}",
109
- args: [
110
- { value: 'placeholder', required: 'false' }
111
- ]
112
- }
113
- ],
114
- physical: [
115
- {
116
- type: 'postalAddress',
117
- address_parts: [
118
- {
119
- type: 'country',
120
- value: 'Austrlia'
121
- },
122
- ]
123
- },
124
- {
125
- address_parts: [
126
- {
127
- type: 'telephoneNumber',
128
- value: '+61 2 9123 4567'
129
- }
130
- ]
131
- }
132
- ]
133
- }
134
- ]
135
- }
136
- ]
137
- end
138
-
139
- def collection_coverage
140
- [
141
- {
142
- spatials: [
143
- {
144
- value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
145
- type: 'gml'
146
- }
147
- ],
148
- temporals: [
149
- {
150
- dates: [
151
- {
152
- value: Time.new(2012, 6, 14).utc,
153
- date_format: 'UTC',
154
- type: 'dateFrom'
155
- },
156
- {
157
- value: Time.new(2013, 6, 14).utc,
158
- date_format: 'UTC',
159
- type: 'dateTo'
160
- },
161
- ],
162
- text: ['Self destructs in 1 year']
163
- }
164
- ]
165
- }
166
- ]
167
- end
168
-
169
- def collection_descriptions
170
- [
171
- {
172
- value: 'A researcher',
173
- type: 'brief',
174
- 'xmllang' => nil
175
- },
176
- {
177
- value: 'Not just any researcher',
178
- type: 'full'
179
- }
180
- ]
181
- end
182
-
183
- def collection_existence_dates
184
- [
185
- {
186
- start_date: {
187
- value: Time.new(2012, 6, 14).utc,
188
- date_format: 'UTC'
189
- },
190
- end_date: {
191
- }
192
- }
193
- ]
194
- end
195
-
196
- def collection_rights
197
- [
198
- {
199
- rights_statement: {
200
- rights_uri: 'http://www.intersect.org.au/policies',
201
- value: 'Copyright 2012 Intersect Australia Ltd.'
202
- },
203
- licence: {
204
- value: 'Attribution (CC BY)',
205
- rights_uri: 'http://creativecommons.org/licenses/by/3.0',
206
- type: ''
207
- },
208
- access_rights: {
209
- value: 'Available to all without restriction'
210
- }
211
- }
212
- ]
213
- end
214
-
215
- def collection_subjects
216
- [
217
- {
218
- value: '123456',
219
- type: 'anzsrc-for'
220
- }
221
- ]
222
- end
223
-
224
- def collection_citation_info
225
- [
226
- {
227
- full_citation: {
228
- style: 'Harvard',
229
- value: 'Australian Bureau of Agricultural and Resource Economics 2001, Aquaculture development in Australia: a review of key economic issues, ABARE, Canberra.'
230
- },
231
- citation_metadata: {
232
- identifier: {
233
- type: 'isbn',
234
- value: '1234'
235
- },
236
- contributor: [
237
- {
238
- name_parts: [
239
- { type: 'title', value: 'Dr' },
240
- { type: 'given', value: 'Jane' },
241
- { type: 'family', value: 'Doe' }
242
- ]
243
- }
244
- ],
245
- title: 'Aquaculture development in Australia: a review of key economic issues',
246
- edition: '1st',
247
- publisher: 'ABARE',
248
- place_published: 'Canberra',
249
- date: [
250
- {
251
- value: '2012-06-14',
252
- type: 'publicationDate'
253
- }
254
- ],
255
- url: 'http://example.com',
256
- context: 'local'
257
- }
258
- }
259
- ]
260
- end
261
-
262
- end
263
-
264
- it "should give a RIF-CS XML Collection record for a model" do
265
- expected = IO.read(File.join(File.dirname(__FILE__), 'files', 'collection.xml'))
266
- collection = CollectionExample.new
267
- collection.to_rifcs.to_xml.should eq(expected)
268
- end
269
-
270
- end