nsastorage 0.8.0 → 1.0.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/dimensions.rb +4 -2
- data/lib/nsastorage/price.rb +4 -1
- 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: e1449618a0f78eef6911c81caf0d8af5c1c3b3f372da510e7bbde4dd615f629f
|
4
|
+
data.tar.gz: 97d8d7a0814af12b1cebe8c844c5289aada32b1975a29e0fbd2fd6ae1d4ff924
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0add97c3b44b57b0f8611580e392a7c3cef55dd646c1dd67038bbb7b066ad22951fcbd2d4f425ce9438c8b811ae63b4f42c186f121ddb860dc076b0b0252067c
|
7
|
+
data.tar.gz: '0096c864db029f0dc90d9c35d5e32eed388e22c66f49085aec5173fbd079c0e06d7392afbcb19a2fe8e16e7f0198f2d091fe4c095bcab837a6efd7f5b7dd530d'
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module NSAStorage
|
4
4
|
# The dimensions (width + depth + sqft) of a price.
|
5
5
|
class Dimensions
|
6
|
+
DEFAULT_WIDTH = 5.0 # feet
|
7
|
+
DEFAULT_DEPTH = 5.0 # feet
|
6
8
|
DEFAULT_HEIGHT = 8.0 # feet
|
7
9
|
|
8
10
|
DIMENSIONS_REGEX = /(?<width>[\d\.]+) x (?<depth>[\d\.]+)/
|
@@ -65,8 +67,8 @@ module NSAStorage
|
|
65
67
|
text = element.at_css('.unit-select-item-detail').text
|
66
68
|
match = DIMENSIONS_REGEX.match(text)
|
67
69
|
|
68
|
-
width = Float(match[:width])
|
69
|
-
depth = Float(match[:depth])
|
70
|
+
width = match ? Float(match[:width]) : DEFAULT_WIDTH
|
71
|
+
depth = match ? Float(match[:depth]) : DEFAULT_DEPTH
|
70
72
|
new(depth:, width:, height: DEFAULT_HEIGHT)
|
71
73
|
end
|
72
74
|
end
|
data/lib/nsastorage/price.rb
CHANGED
@@ -27,7 +27,10 @@ module NSAStorage
|
|
27
27
|
# @return [Array<Price>]
|
28
28
|
def self.fetch(facility_id:)
|
29
29
|
url = "https://www.nsastorage.com/facility-units/#{facility_id}"
|
30
|
-
|
30
|
+
data = Crawler.json(url:)['data']
|
31
|
+
return [] if data['error']
|
32
|
+
|
33
|
+
html = data['html']['units']
|
31
34
|
Nokogiri::HTML(html).css(PRICE_SELECTOR).map { |element| parse(element:) }
|
32
35
|
end
|
33
36
|
|
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: 0.
|
4
|
+
version: 1.0.0
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|