nsastorage 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nsastorage/address.rb +5 -5
- data/lib/nsastorage/facility.rb +1 -1
- data/lib/nsastorage/geocode.rb +4 -2
- data/lib/nsastorage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89b754ea451addb5ab00d398e0ade84be07ff22ae812c53f5abad7f02feac2d0
|
4
|
+
data.tar.gz: 70960c72724ced477f7505d91175c4efe7bebf7133446d65451908f08b58e051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b6e382a1081fe2e90e576f0138cbf2c13fb6d24048ac1b9a1c3ff7bf20f9366d96b47bfd069f3d1c3f304da1d25716f9ce8a3d4a0b8d0271b0e8ee026c37bb0
|
7
|
+
data.tar.gz: b98fc06b0cab39ca5e45a216eac943685314646f4b9186929f2ee1f89366777f0c53588bc564b07c773f2b895b7c70e8e2664f756128dd2d98a145cae2bce850
|
data/lib/nsastorage/address.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module NSAStorage
|
4
4
|
# The address (street + city + state + zip) of a facility.
|
5
5
|
class Address
|
6
|
-
ADDRESS_SELECTOR = '.item-des-box .text-box
|
6
|
+
ADDRESS_SELECTOR = '.item-des-box .text-box .part_title_1'
|
7
7
|
ADDRESS_REGEX = /(?<street>.+),\s+(?<city>.+),\s+(?<state>.+)\s+(?<zip>\d{5})/
|
8
8
|
# @attribute [rw] street
|
9
9
|
# @return [String]
|
@@ -55,10 +55,10 @@ module NSAStorage
|
|
55
55
|
element = document.at_css(ADDRESS_SELECTOR)
|
56
56
|
match = element.text.match(ADDRESS_REGEX)
|
57
57
|
new(
|
58
|
-
street: match[:street],
|
59
|
-
city: match[:city],
|
60
|
-
state: match[:state],
|
61
|
-
zip: match[:zip]
|
58
|
+
street: match[:street].strip,
|
59
|
+
city: match[:city].strip,
|
60
|
+
state: match[:state].strip,
|
61
|
+
zip: match[:zip].strip
|
62
62
|
)
|
63
63
|
end
|
64
64
|
end
|
data/lib/nsastorage/facility.rb
CHANGED
data/lib/nsastorage/geocode.rb
CHANGED
@@ -18,8 +18,10 @@ module NSAStorage
|
|
18
18
|
#
|
19
19
|
# @return [Geocode]
|
20
20
|
def self.parse(document:)
|
21
|
-
latitude = LATITUDE_REGEX.match(document.text)[:latitude
|
22
|
-
longitude = LONGITUDE_REGEX.match(document.text)[:longitude
|
21
|
+
latitude = LATITUDE_REGEX.match(document.text)&.[](:latitude)
|
22
|
+
longitude = LONGITUDE_REGEX.match(document.text)&.[](:longitude)
|
23
|
+
|
24
|
+
return if latitude.nil? || longitude.nil?
|
23
25
|
|
24
26
|
new(latitude: Float(latitude), longitude: Float(longitude))
|
25
27
|
end
|
data/lib/nsastorage/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsastorage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|