dwc-archive 0.4.1 → 0.4.2

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 CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -73,22 +73,26 @@ class DarwinCore
73
73
  if @core[:acceptednameusageid] && r[@core[:acceptednameusageid]] && r[@core[:acceptednameusageid]] != r[@core[:id]]
74
74
  add_synonym_from_core(@core[:acceptednameusageid], r)
75
75
  elsif !@core[:acceptednameusageid] && status_synonym?(r[@core[:taxonomicstatus]])
76
- add_synonym_from_core(@core[:highertaxonid], r)
76
+ add_synonym_from_core(parent_id, r)
77
77
  else
78
78
  taxon = @res[r[@core[:id]]] ? @res[r[@core[:id]]] : @res[r[@core[:id]]] = DarwinCore::TaxonNormalized.new
79
79
  taxon.id = r[@core[:id]]
80
80
  taxon.current_name = r[@core[:scientificname]]
81
81
  taxon.current_name_canonical = canonical_name(r[@core[:scientificname]])
82
- taxon.parent_id = r[@core[:highertaxonid]]
83
- taxon.rank = r[@core[:taxonrank]]
84
- taxon.status = r[@core[:taxonomicstatus]]
82
+ taxon.parent_id = r[parent_id]
83
+ taxon.rank = r[@core[:taxonrank]] if @core[:taxonrank]
84
+ taxon.status = r[@core[:taxonomicstatus]] if @core[:taxonomicstatus]
85
85
  end
86
86
  end
87
87
  end
88
+
89
+ def parent_id
90
+ parent_id_field = @core[:highertaxonid] || @core[:parentnameusageid]
91
+ end
88
92
 
89
93
  def calculate_classification_path
90
94
  @res.each do |taxon_id, taxon|
91
- next if taxon.classification_path
95
+ next if taxon.classification_path
92
96
  get_classification_path(taxon)
93
97
  end
94
98
  end
@@ -122,7 +126,7 @@ class DarwinCore
122
126
  @res[r[fields[:id]]].synonyms << SynonymNormalized.new(
123
127
  r[fields[:scientificname]],
124
128
  canonical_name(r[fields[:scientificname]]),
125
- r[fields[:taxonomicstatus]])
129
+ fields[:taxonomicstatus] ? r[fields[:taxonomicstatus]] : nil)
126
130
  end
127
131
  end
128
132
 
@@ -131,7 +135,7 @@ class DarwinCore
131
135
  ext.read[0].each do |r|
132
136
  @res[r[fields[:id]]].vernacular_names << VernacularNormalized.new(
133
137
  r[fields[:vernacularname]],
134
- r[fields[:languagecode]])
138
+ fields[:languagecode] ? r[fields[:languagecode]] : nil)
135
139
  end
136
140
  end
137
141
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dwc-archive
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 4
9
- - 1
10
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Dmitry Mozzherin
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 13
30
28
  segments:
31
29
  - 1
32
30
  - 2
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 3
46
43
  segments:
47
44
  - 0
48
45
  version: "0"
@@ -115,7 +112,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
112
  requirements:
116
113
  - - ">="
117
114
  - !ruby/object:Gem::Version
118
- hash: 3
119
115
  segments:
120
116
  - 0
121
117
  version: "0"
@@ -124,7 +120,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
120
  requirements:
125
121
  - - ">="
126
122
  - !ruby/object:Gem::Version
127
- hash: 3
128
123
  segments:
129
124
  - 0
130
125
  version: "0"