datacite-mapping 0.2.3 → 0.2.4
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.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/datacite/mapping/geo_location_box.rb +4 -2
- data/lib/datacite/mapping/module_info.rb +1 -1
- data/lib/datacite/mapping/resource.rb +8 -5
- data/spec/unit/datacite/mapping/geo_location_box_spec.rb +6 -14
- data/spec/unit/datacite/mapping/resource_spec.rb +5 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d570ed19b36949ccbd477c42b99eb16decca70
|
4
|
+
data.tar.gz: 3f9608fb7b9520b69bfc5a4f802d36d3cfeba96b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4d62507b31e9a3c3086ae9a4f2721c7e8539d0e08d49ccff037e85eaca7a2b740d3055791ba81f8df5589e01ca0ab04d90beec3881c979039a58f874a06a4a
|
7
|
+
data.tar.gz: 56f0d8270aca2b12cca28998fca293490d8cb30ff89f4af1274fbb571bb81bd1a99d50f978cf42b6e1532ec4e573ebdecaf8e5b067978d5bc5dfb1b6b839cfeb
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.2.4 (8 November 2016)
|
2
|
+
|
3
|
+
- Fix issue where writing a resource in Datacite 3 would cause the Datacite 3 namespace
|
4
|
+
to stick around, even when later writing Datacite 4.
|
5
|
+
- Remove well-intentioned but ill-advised feature that would auto-sort `<geoLocationBox/>`
|
6
|
+
coordinates into north/south and east/west.
|
7
|
+
|
1
8
|
## 0.2.3 (5 October 2016)
|
2
9
|
|
3
10
|
- Allow empty `<identifier/>` tags on read, but not write
|
@@ -117,8 +117,10 @@ module Datacite
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def init_from_array(coordinates)
|
120
|
-
self.south_latitude
|
121
|
-
self.
|
120
|
+
self.south_latitude = coordinates[0]
|
121
|
+
self.north_latitude = coordinates[2]
|
122
|
+
self.west_longitude = coordinates[1]
|
123
|
+
self.east_longitude = coordinates[3]
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
@@ -28,12 +28,15 @@ module Datacite
|
|
28
28
|
|
29
29
|
# Overrides Namespaced::InstanceMethods.fill_into_xml to check mapping
|
30
30
|
def fill_into_xml(xml, options = { mapping: :_default })
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
current_namespace = namespace
|
32
|
+
return super if options[:mapping] != :datacite_3 || current_namespace.uri == DATACITE_3_NAMESPACE.uri
|
33
|
+
|
34
|
+
begin
|
35
|
+
@namespace = DATACITE_3_NAMESPACE.with_prefix(current_namespace.prefix)
|
36
|
+
super
|
37
|
+
ensure
|
38
|
+
@namespace = current_namespace
|
35
39
|
end
|
36
|
-
super
|
37
40
|
end
|
38
41
|
|
39
42
|
# Initialies a new {Resource}
|
@@ -12,20 +12,12 @@ module Datacite
|
|
12
12
|
expect(box.east_longitude).to eq(-70.67)
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'accepts a quad
|
16
|
-
box = GeoLocationBox.new(-
|
17
|
-
expect(box.south_latitude).to eq(-
|
18
|
-
expect(box.west_longitude).to eq(
|
19
|
-
expect(box.north_latitude).to eq(
|
20
|
-
expect(box.east_longitude).to eq(-
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'accepts a quad with flipped north/south coordinates' do
|
24
|
-
box = GeoLocationBox.new(47.61, -122.33, -33.45, -70.67)
|
25
|
-
expect(box.south_latitude).to eq(-33.45)
|
26
|
-
expect(box.west_longitude).to eq(-122.33)
|
27
|
-
expect(box.north_latitude).to eq(47.61)
|
28
|
-
expect(box.east_longitude).to eq(-70.67)
|
15
|
+
it 'accepts a quad crossing 180°' do
|
16
|
+
box = GeoLocationBox.new(-41.289, 174.777, 21.3, -157.817)
|
17
|
+
expect(box.south_latitude).to eq(-41.289)
|
18
|
+
expect(box.west_longitude).to eq(174.777)
|
19
|
+
expect(box.north_latitude).to eq(21.3)
|
20
|
+
expect(box.east_longitude).to eq(-157.817)
|
29
21
|
end
|
30
22
|
|
31
23
|
it 'accepts :south_latitude, :west_longitude, :north_latitude, :east_longitude' do
|
@@ -1045,6 +1045,11 @@ module Datacite
|
|
1045
1045
|
expect(rexml.namespace).to eq(DATACITE_3_NAMESPACE.uri)
|
1046
1046
|
end
|
1047
1047
|
|
1048
|
+
it 'still writes DC4 by default after writing DC3' do
|
1049
|
+
dc4xml = resource.save_to_xml
|
1050
|
+
expect(dc4xml.namespace).to eq(DATACITE_4_NAMESPACE.uri)
|
1051
|
+
end
|
1052
|
+
|
1048
1053
|
it 'warns about givenNames and familyNames' do
|
1049
1054
|
name_tags = %w(givenName familyName)
|
1050
1055
|
name_tags.each do |tag|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datacite-mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typesafe_enum
|
@@ -656,4 +656,3 @@ test_files:
|
|
656
656
|
- spec/unit/datacite/mapping/rights_spec.rb
|
657
657
|
- spec/unit/datacite/mapping/subject_spec.rb
|
658
658
|
- spec/unit/datacite/mapping/title_spec.rb
|
659
|
-
has_rdoc:
|