nsastorage 0.9.0 → 1.0.1
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/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: 0f13e7fb615668101d5da8a5549bb85779e59499c55d6935e9d4fd2f369a1b74
|
4
|
+
data.tar.gz: c2aa0859eea895d690d3e24ea7de9a2f7673be7de4fe842f31f1f81c39c702c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2725593f7e064e70ea041f0f031cf1a2be8e7d0f024b09e14384821391748d86d6efcf081b0d89817405c89e2d253b2da0a045f0664209c19b0bd033de05c2b4
|
7
|
+
data.tar.gz: 2399ae9154b3a1ac1d8af45d3aae39425f67a060aed5679e47d57d821022525539ce4b1c79e2e8e5843d3202fc9e0cea2c11febe67d16e06a41f52eb4a882079
|
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/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.1
|
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
|