takuhai_status 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/takuhai_status/usps.rb +3 -3
- data/lib/takuhai_status/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d2a4a7fabf7a2abd08e23983986e988eb1228559298f94dfc09ca43e67a2d25
|
4
|
+
data.tar.gz: 9b9dce93a78662311fe2ebe934819b870e736d2cc40fa6554f00d39fe1bf9cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3e3005ed57b718293a287e77633102792a5cff7b109f185df2e9470d7f2d5de104e2e0851cf890d7215f9398d6d194fc4ee68c790e9b3a10a20b7f0c851a0e
|
7
|
+
data.tar.gz: 52f1c1542faf872e64521cafca8af6f0e4e4cd9cc8389fd647b1ddf80d50a032f7fb257ec4a4d55b85ac176f293b74fe5edfcc5ef747149e10ffc822d4a82d17
|
data/lib/takuhai_status/usps.rb
CHANGED
@@ -21,9 +21,9 @@ module TakuhaiStatus
|
|
21
21
|
url = "https://tools.usps.com/go/TrackConfirmAction?tLabels=#{@key}"
|
22
22
|
html = Faraday.new(url: url).get.body
|
23
23
|
date, status, detail = Nokogiri(html).css('div.status_feed p');
|
24
|
-
date_str = date.text.strip
|
25
|
-
status_str = status.text.gsub(/\u00A0/, ' ').strip
|
26
|
-
detail_str = detail.text.gsub(/\u00A0/, ' ').strip
|
24
|
+
date_str = date ? date.text.strip : ''
|
25
|
+
status_str = status ? status.text.gsub(/\u00A0/, ' ').strip : ''
|
26
|
+
detail_str = detail ? detail.text.gsub(/\u00A0/, ' ').strip : ''
|
27
27
|
|
28
28
|
unless date_str.empty?
|
29
29
|
return Time.parse(date_str), "#{status_str} (#{detail_str})"
|