rif-cs 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +9 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/rif-cs.rb +167 -0
- data/lib/rif-cs/activity.rb +45 -0
- data/lib/rif-cs/collection.rb +74 -0
- data/lib/rif-cs/party.rb +45 -0
- data/lib/rif-cs/service.rb +40 -0
- data/rif-cs.gemspec +75 -0
- data/spec/files/activity.xml +59 -0
- data/spec/files/collection.xml +73 -0
- data/spec/files/party.xml +61 -0
- data/spec/files/service.xml +63 -0
- data/spec/rif-cs_activity_spec.rb +217 -0
- data/spec/rif-cs_collection_spec.rb +270 -0
- data/spec/rif-cs_party_spec.rb +228 -0
- data/spec/rif-cs_service_spec.rb +223 -0
- data/spec/rif-cs_spec.rb +388 -0
- data/spec/spec_helper.rb +12 -0
- metadata +129 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
module RIFCS
|
2
|
+
module Service
|
3
|
+
include RIFCS
|
4
|
+
require 'nokogiri'
|
5
|
+
|
6
|
+
def to_rifcs(encoding='UTF-8')
|
7
|
+
Nokogiri::XML::Builder.new(:encoding => encoding) do |xml|
|
8
|
+
xml.registryObject_(:group => service_group) do
|
9
|
+
xml.key_ service_key
|
10
|
+
xml.originatingSource_ service_originating_source if respond_to?(:service_originating_source)
|
11
|
+
|
12
|
+
xml.service_(:dateModified => service_root[:date_modified], :type => service_root[:type]) do
|
13
|
+
RIFCS::list_of(service_identifiers, :identifiers, xml) if respond_to?(:service_identifiers)
|
14
|
+
|
15
|
+
RIFCS::names(service_names, xml) if respond_to?(:service_names)
|
16
|
+
|
17
|
+
RIFCS::locations(service_locations, xml) if respond_to?(:service_locations)
|
18
|
+
|
19
|
+
RIFCS::coverage(service_coverage, xml) if respond_to?(:service_coverage)
|
20
|
+
|
21
|
+
RIFCS::related_objects(service_related_objects, xml) if respond_to?(:service_related_objects)
|
22
|
+
|
23
|
+
RIFCS::subjects(service_subjects, xml) if respond_to?(:service_subjects)
|
24
|
+
|
25
|
+
RIFCS::list_of(service_descriptions, :descriptions, xml) if respond_to?(:service_descriptions)
|
26
|
+
|
27
|
+
RIFCS::list_of(service_access_policies, :access_policies, xml) if respond_to?(:service_access_policies)
|
28
|
+
|
29
|
+
RIFCS::rights(service_rights, xml) if respond_to?(:service_rights)
|
30
|
+
|
31
|
+
RIFCS::existence_dates(service_existence_dates, xml) if respond_to?(:service_existence_dates)
|
32
|
+
|
33
|
+
RIFCS::related_info(service_related_info, xml) if respond_to?(:service_related_info)
|
34
|
+
end # service
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
data/rif-cs.gemspec
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "rif-cs"
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Sean McCarthy"]
|
12
|
+
s.date = "2012-06-25"
|
13
|
+
s.description = "Instrument your class to return RIF-CS"
|
14
|
+
s.email = "sean@intersect.org.au"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/rif-cs.rb",
|
29
|
+
"lib/rif-cs/activity.rb",
|
30
|
+
"lib/rif-cs/collection.rb",
|
31
|
+
"lib/rif-cs/party.rb",
|
32
|
+
"lib/rif-cs/service.rb",
|
33
|
+
"rif-cs.gemspec",
|
34
|
+
"spec/files/activity.xml",
|
35
|
+
"spec/files/collection.xml",
|
36
|
+
"spec/files/party.xml",
|
37
|
+
"spec/files/service.xml",
|
38
|
+
"spec/rif-cs_activity_spec.rb",
|
39
|
+
"spec/rif-cs_collection_spec.rb",
|
40
|
+
"spec/rif-cs_party_spec.rb",
|
41
|
+
"spec/rif-cs_service_spec.rb",
|
42
|
+
"spec/rif-cs_spec.rb",
|
43
|
+
"spec/spec_helper.rb"
|
44
|
+
]
|
45
|
+
s.homepage = "http://github.com/IntersectAustralia/ruby_rif-cs"
|
46
|
+
s.licenses = ["MIT"]
|
47
|
+
s.require_paths = ["lib"]
|
48
|
+
s.rubygems_version = "1.8.15"
|
49
|
+
s.summary = "Instrument your class to return RIF-CS"
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.1.0"])
|
59
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
62
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
63
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
64
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
66
|
+
end
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
71
|
+
s.add_dependency(%q<bundler>, ["~> 1.1.0"])
|
72
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<registryObject group="test group">
|
3
|
+
<key>a key</key>
|
4
|
+
<originatingSource>tomato</originatingSource>
|
5
|
+
<activity dateModified="2012-06-13 14:00:00 UTC" type="program">
|
6
|
+
<identifiers type="uri">http://example.com</identifiers>
|
7
|
+
<identifiers type="local">123</identifiers>
|
8
|
+
<name dateFrom="" dateTo="" type="primary" xml:lang="">
|
9
|
+
<namePart type="">Testing of software</namePart>
|
10
|
+
</name>
|
11
|
+
<location dateFrom="2012-06-13 14:00:00 UTC" dateTo="" type="">
|
12
|
+
<address>
|
13
|
+
<electronic type="email">
|
14
|
+
<value>joe@example.com</value>
|
15
|
+
</electronic>
|
16
|
+
<electronic type="uri">
|
17
|
+
<value>http://example.com/people/a key</value>
|
18
|
+
<arg required="false" type="" use="">placeholder</arg>
|
19
|
+
</electronic>
|
20
|
+
<physical type="postalAddress" xml:lang="">
|
21
|
+
<addressPart type="country">Austrlia</addressPart>
|
22
|
+
</physical>
|
23
|
+
<physical type="" xml:lang="">
|
24
|
+
<addressPart type="telephoneNumber">+61 2 9123 4567</addressPart>
|
25
|
+
</physical>
|
26
|
+
</address>
|
27
|
+
</location>
|
28
|
+
<coverage>
|
29
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
30
|
+
<temporal>
|
31
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
32
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
33
|
+
<text>Self destructs in 1 year</text>
|
34
|
+
</temporal>
|
35
|
+
</coverage>
|
36
|
+
<descriptions type="brief" xmllang="">An activity</descriptions>
|
37
|
+
<descriptions type="full">Not just any activity</descriptions>
|
38
|
+
<existenceDates>
|
39
|
+
<startDate dateFormat="UTC">2012-06-13 14:00:00 UTC</startDate>
|
40
|
+
<endDate dateFormat=""></endDate>
|
41
|
+
</existenceDates>
|
42
|
+
<relatedObject>
|
43
|
+
<key>b party</key>
|
44
|
+
<relation type="hasAssociationWith">
|
45
|
+
<description>Supervisor</description>
|
46
|
+
</relation>
|
47
|
+
</relatedObject>
|
48
|
+
<relatedObject>
|
49
|
+
<key>some group</key>
|
50
|
+
<relation type="isMemberOf"/>
|
51
|
+
</relatedObject>
|
52
|
+
<rights>
|
53
|
+
<rightsStatement rightsUri="http://www.intersect.org.au/policies">Copyright 2012 Intersect Australia Ltd.</rightsStatement>
|
54
|
+
<licence rightsUri="http://creativecommons.org/licenses/by/3.0">Attribution (CC BY)</licence>
|
55
|
+
<accessRights rightsUri="">Available to all without restriction</accessRights>
|
56
|
+
</rights>
|
57
|
+
<subject termIdentifier="" type="anzsrc-for" xml:lang="">123456</subject>
|
58
|
+
</activity>
|
59
|
+
</registryObject>
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<registryObject group="test group">
|
3
|
+
<key>a key</key>
|
4
|
+
<originatingSource>tomato</originatingSource>
|
5
|
+
<collection dateModified="2012-06-13 14:00:00 UTC" type="dataset" dateAccessioned="2012-06-13 14:00:00 UTC">
|
6
|
+
<identifiers type="uri">http://example.com</identifiers>
|
7
|
+
<identifiers type="local">123</identifiers>
|
8
|
+
<name dateFrom="" dateTo="" type="primary" xml:lang="">
|
9
|
+
<namePart type="title">Dr</namePart>
|
10
|
+
<namePart type="given">John</namePart>
|
11
|
+
<namePart type="family">Doe</namePart>
|
12
|
+
</name>
|
13
|
+
<location dateFrom="2012-06-13 14:00:00 UTC" dateTo="" type="">
|
14
|
+
<address>
|
15
|
+
<electronic type="email">
|
16
|
+
<value>joe@example.com</value>
|
17
|
+
</electronic>
|
18
|
+
<electronic type="uri">
|
19
|
+
<value>http://example.com/people/a key</value>
|
20
|
+
<arg required="false" type="" use="">placeholder</arg>
|
21
|
+
</electronic>
|
22
|
+
<physical type="postalAddress" xml:lang="">
|
23
|
+
<addressPart type="country">Austrlia</addressPart>
|
24
|
+
</physical>
|
25
|
+
<physical type="" xml:lang="">
|
26
|
+
<addressPart type="telephoneNumber">+61 2 9123 4567</addressPart>
|
27
|
+
</physical>
|
28
|
+
</address>
|
29
|
+
</location>
|
30
|
+
<coverage>
|
31
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
32
|
+
<temporal>
|
33
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
34
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
35
|
+
<text>Self destructs in 1 year</text>
|
36
|
+
</temporal>
|
37
|
+
</coverage>
|
38
|
+
<relatedObject>
|
39
|
+
<key>b party</key>
|
40
|
+
<relation type="hasAssociationWith">
|
41
|
+
<description>owner</description>
|
42
|
+
</relation>
|
43
|
+
</relatedObject>
|
44
|
+
<relatedObject>
|
45
|
+
<key>some group</key>
|
46
|
+
<relation type="isMemberOf"/>
|
47
|
+
</relatedObject>
|
48
|
+
<subject termIdentifier="" type="anzsrc-for" xml:lang="">123456</subject>
|
49
|
+
<descriptions type="brief" xmllang="">A researcher</descriptions>
|
50
|
+
<descriptions type="full">Not just any researcher</descriptions>
|
51
|
+
<rights>
|
52
|
+
<rightsStatement rightsUri="http://www.intersect.org.au/policies">Copyright 2012 Intersect Australia Ltd.</rightsStatement>
|
53
|
+
<licence rightsUri="http://creativecommons.org/licenses/by/3.0">Attribution (CC BY)</licence>
|
54
|
+
<accessRights rightsUri="">Available to all without restriction</accessRights>
|
55
|
+
</rights>
|
56
|
+
<fullCitation style="Harvard">Australian Bureau of Agricultural and Resource Economics 2001, Aquaculture development in Australia: a review of key economic issues, ABARE, Canberra.</fullCitation>
|
57
|
+
<citationMetadata>
|
58
|
+
<identifier type="isbn">1234</identifier>
|
59
|
+
<contributor seq="">
|
60
|
+
<namePart type="title">Dr</namePart>
|
61
|
+
<namePart type="given">Jane</namePart>
|
62
|
+
<namePart type="family">Doe</namePart>
|
63
|
+
</contributor>
|
64
|
+
<title>Aquaculture development in Australia: a review of key economic issues</title>
|
65
|
+
<edition>1st</edition>
|
66
|
+
<publisher>ABARE</publisher>
|
67
|
+
<placePublished>Canberra</placePublished>
|
68
|
+
<date type="publicationDate">2012-06-14</date>
|
69
|
+
<url>http://example.com</url>
|
70
|
+
<context>local</context>
|
71
|
+
</citationMetadata>
|
72
|
+
</collection>
|
73
|
+
</registryObject>
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<registryObject group="test group">
|
3
|
+
<key>a key</key>
|
4
|
+
<originatingSource>tomato</originatingSource>
|
5
|
+
<party dateModified="2012-06-13 14:00:00 UTC" type="person">
|
6
|
+
<identifiers type="uri">http://example.com</identifiers>
|
7
|
+
<identifiers type="local">123</identifiers>
|
8
|
+
<name dateFrom="" dateTo="" type="primary" xml:lang="">
|
9
|
+
<namePart type="title">Dr</namePart>
|
10
|
+
<namePart type="given">John</namePart>
|
11
|
+
<namePart type="family">Doe</namePart>
|
12
|
+
</name>
|
13
|
+
<location dateFrom="2012-06-13 14:00:00 UTC" dateTo="" type="">
|
14
|
+
<address>
|
15
|
+
<electronic type="email">
|
16
|
+
<value>joe@example.com</value>
|
17
|
+
</electronic>
|
18
|
+
<electronic type="uri">
|
19
|
+
<value>http://example.com/people/a key</value>
|
20
|
+
<arg required="false" type="" use="">placeholder</arg>
|
21
|
+
</electronic>
|
22
|
+
<physical type="postalAddress" xml:lang="">
|
23
|
+
<addressPart type="country">Austrlia</addressPart>
|
24
|
+
</physical>
|
25
|
+
<physical type="" xml:lang="">
|
26
|
+
<addressPart type="telephoneNumber">+61 2 9123 4567</addressPart>
|
27
|
+
</physical>
|
28
|
+
</address>
|
29
|
+
</location>
|
30
|
+
<coverage>
|
31
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
32
|
+
<temporal>
|
33
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
34
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
35
|
+
<text>Self destructs in 1 year</text>
|
36
|
+
</temporal>
|
37
|
+
</coverage>
|
38
|
+
<descriptions type="brief" xmllang="">A researcher</descriptions>
|
39
|
+
<descriptions type="full">Not just any researcher</descriptions>
|
40
|
+
<existenceDates>
|
41
|
+
<startDate dateFormat="UTC">2012-06-13 14:00:00 UTC</startDate>
|
42
|
+
<endDate dateFormat=""></endDate>
|
43
|
+
</existenceDates>
|
44
|
+
<relatedObject>
|
45
|
+
<key>b party</key>
|
46
|
+
<relation type="hasAssociationWith">
|
47
|
+
<description>Supervisor</description>
|
48
|
+
</relation>
|
49
|
+
</relatedObject>
|
50
|
+
<relatedObject>
|
51
|
+
<key>some group</key>
|
52
|
+
<relation type="isMemberOf"/>
|
53
|
+
</relatedObject>
|
54
|
+
<rights>
|
55
|
+
<rightsStatement rightsUri="http://www.intersect.org.au/policies">Copyright 2012 Intersect Australia Ltd.</rightsStatement>
|
56
|
+
<licence rightsUri="http://creativecommons.org/licenses/by/3.0">Attribution (CC BY)</licence>
|
57
|
+
<accessRights rightsUri="">Available to all without restriction</accessRights>
|
58
|
+
</rights>
|
59
|
+
<subject termIdentifier="" type="anzsrc-for" xml:lang="">123456</subject>
|
60
|
+
</party>
|
61
|
+
</registryObject>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<registryObject group="Intersect Australia">
|
3
|
+
<key>service key</key>
|
4
|
+
<originatingSource>http://www.intersect.org.au</originatingSource>
|
5
|
+
<service dateModified="2012-06-13 14:00:00 UTC" type="create">
|
6
|
+
<identifiers type="local">hdl:1959.4/004_311</identifiers>
|
7
|
+
<name dateFrom="2012-06-14 00:00:00 +1000" dateTo="2013-06-14 00:00:00 +1000" type="create" xml:lang="">
|
8
|
+
<namePart type="">Autolab PGSTAT 12 Potentiostat</namePart>
|
9
|
+
</name>
|
10
|
+
<location dateFrom="" dateTo="" type="">
|
11
|
+
<address>
|
12
|
+
<electronic type="email">
|
13
|
+
<value>joe@example.com</value>
|
14
|
+
</electronic>
|
15
|
+
<physical type="postalAddress" xml:lang="">
|
16
|
+
<addressPart type="country">Austrlia</addressPart>
|
17
|
+
</physical>
|
18
|
+
<physical type="" xml:lang="">
|
19
|
+
<addressPart type="telephoneNumber">+61 2 9123 4567</addressPart>
|
20
|
+
</physical>
|
21
|
+
</address>
|
22
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
23
|
+
</location>
|
24
|
+
<coverage>
|
25
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
26
|
+
<temporal>
|
27
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
28
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
29
|
+
<text>Self destructs in 1 year</text>
|
30
|
+
</temporal>
|
31
|
+
</coverage>
|
32
|
+
<relatedObject>
|
33
|
+
<key>http://nla.gov.au/nla.party-593921</key>
|
34
|
+
<relation type="hasAssociationWith"/>
|
35
|
+
</relatedObject>
|
36
|
+
<relatedObject>
|
37
|
+
<key>some group</key>
|
38
|
+
<relation type="isPresentedBy"/>
|
39
|
+
</relatedObject>
|
40
|
+
<descriptions type="deliverymethod">offline</descriptions>
|
41
|
+
<descriptions type="full">General-purpose potentiostat.</descriptions>
|
42
|
+
<accessPolicies>http://example.com/policy</accessPolicies>
|
43
|
+
<rights>
|
44
|
+
<rightsStatement rightsUri="http://www.intersect.org.au/policies">Copyright 2012 Intersect Australia Ltd.</rightsStatement>
|
45
|
+
<licence rightsUri="http://creativecommons.org/licenses/by/3.0">Attribution (CC BY)</licence>
|
46
|
+
<accessRights rightsUri="">Available to all without restriction</accessRights>
|
47
|
+
</rights>
|
48
|
+
<existenceDates>
|
49
|
+
<startDate dateFormat="UTC">2012-06-13 14:00:00 UTC</startDate>
|
50
|
+
<endDate dateFormat=""></endDate>
|
51
|
+
</existenceDates>
|
52
|
+
<relatedInfo type="website">
|
53
|
+
<identifier type="uri">http://example.com/personalsites/foo</identifier>
|
54
|
+
<title>This person's blog</title>
|
55
|
+
<notes>Another blog</notes>
|
56
|
+
</relatedInfo>
|
57
|
+
<relatedInfo type="publication">
|
58
|
+
<identifier type="isbn">111</identifier>
|
59
|
+
<title>The Ordering of Things</title>
|
60
|
+
<notes>Not available</notes>
|
61
|
+
</relatedInfo>
|
62
|
+
</service>
|
63
|
+
</registryObject>
|
@@ -0,0 +1,217 @@
|
|
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
|