relaton-iso 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/lib/relaton_iso/hit.rb +10 -0
- data/lib/relaton_iso/hit_collection.rb +21 -0
- data/lib/relaton_iso/iso_bibliography.rb +2 -1
- data/lib/relaton_iso/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36087254e7d4a03e2b10043bf3982b8302c4b03e
|
4
|
+
data.tar.gz: 410db681abb2e79f7cc6f20adc94ea760fb68c5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4de83577a94249d2a11217f279fcd83d1ea982d5a4e3f37ff50f5a1ab2050d8fcffe402ff18f27ae37c06de35af7e612fd07d678bb46623c5258b5646d8f3227
|
7
|
+
data.tar.gz: 8d01def2dddc97a28e4bf7f37f5ea1ebc8210adb55d505a555028762269801a8aed7114040ad89a76cd9e0283c221e6daad739efb7b464638093a0566d249abc
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relaton-iso (0.6.
|
4
|
+
relaton-iso (0.6.1)
|
5
5
|
relaton-iec (~> 0.4.0)
|
6
6
|
relaton-iso-bib (~> 0.3.0)
|
7
7
|
|
@@ -36,13 +36,13 @@ GEM
|
|
36
36
|
pry (~> 0.10)
|
37
37
|
public_suffix (3.1.1)
|
38
38
|
rake (10.5.0)
|
39
|
-
relaton-bib (0.3.
|
39
|
+
relaton-bib (0.3.1)
|
40
40
|
addressable
|
41
41
|
nokogiri (~> 1.10)
|
42
42
|
relaton-iec (0.4.0)
|
43
43
|
addressable
|
44
44
|
relaton-iso-bib (~> 0.3.0)
|
45
|
-
relaton-iso-bib (0.3.
|
45
|
+
relaton-iso-bib (0.3.1)
|
46
46
|
isoics (~> 0.1.6)
|
47
47
|
relaton-bib (~> 0.3.0)
|
48
48
|
ruby_deep_clone (~> 0.8.0)
|
data/lib/relaton_iso/hit.rb
CHANGED
@@ -35,6 +35,13 @@ module RelatonIso
|
|
35
35
|
|
36
36
|
json = JSON.parse resp.body
|
37
37
|
concat(json["standards"].map { |h| Hit.new h, self })
|
38
|
+
sort! do |a, b|
|
39
|
+
if a.sort_weight == b.sort_weight
|
40
|
+
(parse_date(b.hit) - parse_date(a.hit)).to_i
|
41
|
+
else
|
42
|
+
a.sort_weight - b.sort_weight
|
43
|
+
end
|
44
|
+
end
|
38
45
|
end
|
39
46
|
|
40
47
|
# @return [RelatonIso::HitCollection]
|
@@ -69,5 +76,19 @@ module RelatonIso
|
|
69
76
|
end
|
70
77
|
builder.to_xml
|
71
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def parse_date(hit)
|
83
|
+
if hit["publicationDate"]
|
84
|
+
Date.strptime(hit["publicationDate"], "%Y-%m")
|
85
|
+
elsif %r{:(?<year>\d{4})} =~ hit["docRef"]
|
86
|
+
Date.strptime(year, "%Y")
|
87
|
+
elsif hit["newProjectDate"]
|
88
|
+
Date.parse hit["newProjectDate"]
|
89
|
+
else
|
90
|
+
Date.new 0
|
91
|
+
end
|
92
|
+
end
|
72
93
|
end
|
73
94
|
end
|
@@ -142,7 +142,8 @@ module RelatonIso
|
|
142
142
|
def isobib_results_filter(result, year)
|
143
143
|
missed_years = []
|
144
144
|
result.each do |s|
|
145
|
-
|
145
|
+
next if !year && s.hit["publicationStatus"] == "Withdrawn"
|
146
|
+
return { ret: s.fetch } unless year
|
146
147
|
|
147
148
|
%r{:(?<iyear>\d{4})} =~ s.hit["docRef"]
|
148
149
|
return { ret: s.fetch } if iyear == year
|
data/lib/relaton_iso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|