nsastorage 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nsastorage/price.rb +4 -2
- data/lib/nsastorage/sitemap.rb +1 -1
- data/lib/nsastorage/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: ce9d4882c5eff9fafb6acf3e973cb3e48a56a7f81d32a2409ec5420db465b0e9
|
4
|
+
data.tar.gz: d743ca5567e457d70989e375a625cc40b9f90139d3d3389681b5e85d56d96b69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deef28780dff57b43af1eefa9c83f3beecc3a225eb208f522b8c9652fdd768224024c3b20e321b35bcfd74f0770dbb3b42c8b6b644578ddd43f95f4e573d990c
|
7
|
+
data.tar.gz: 004ebc2fb6f5aadc8e9f919db17b409e0064aa5ccd7a38ba519637107a930d6a6aa4a0527abd56535a9d5a31bd4738f9426218b15c1c300ec501a1550f78d070
|
data/lib/nsastorage/price.rb
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
module NSAStorage
|
4
4
|
# The price (id + dimensions + rate) for a facility.
|
5
5
|
class Price
|
6
|
-
ID_REGEX = %r{(?<id>\d+)/rent/}
|
6
|
+
ID_REGEX = %r{(?<id>\d+)/(?:rent|reserve)/}
|
7
|
+
PRICE_SELECTOR = '[data-unit-size="small"],[data-unit-size="medium"],[data-unit-size="large"]'
|
8
|
+
|
7
9
|
# @attribute [rw] id
|
8
10
|
# @return [String]
|
9
11
|
attr_accessor :id
|
@@ -26,7 +28,7 @@ module NSAStorage
|
|
26
28
|
def self.fetch(facility_id:)
|
27
29
|
url = "https://www.nsastorage.com/facility-units/#{facility_id}"
|
28
30
|
html = Crawler.json(url:)['data']['html']['units']
|
29
|
-
Nokogiri::HTML(html).css(
|
31
|
+
Nokogiri::HTML(html).css(PRICE_SELECTOR).map { |element| parse(element:) }
|
30
32
|
end
|
31
33
|
|
32
34
|
# @param id [String]
|
data/lib/nsastorage/sitemap.rb
CHANGED
data/lib/nsastorage/version.rb
CHANGED