extraspace 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/extraspace/facility.rb +26 -4
- data/lib/extraspace/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca4e342bb9f821e482ae14ba01225c5e8f15a6214b902b4f3b5625c25a417a2b
|
4
|
+
data.tar.gz: ac6c2323e43a2bc73768e8baca46c9558781c1a208e7818aabcbd47b7233f652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60fb031eb92778affb4a5a5e31839d8e007822a10343f981c0791b652510b0d1497be4b707337b9304f35d50f7dd5b655546d55d371d6261c4c9f18e5eb6bcf2
|
7
|
+
data.tar.gz: bb646645850b03041c519fa1b15fb2b24b236c97ede2ec7a8844372f15c095f0d8108e07e735780db7b1c13e26fada06ce63022725258efe96f7b665e86350cb
|
data/lib/extraspace/facility.rb
CHANGED
@@ -63,17 +63,39 @@ module ExtraSpace
|
|
63
63
|
data = parse_next_data(document: document)
|
64
64
|
page_data = data.dig('props', 'pageProps', 'pageData', 'data')
|
65
65
|
store_data = page_data.dig('facilityData', 'data', 'store')
|
66
|
-
unit_classes = page_data.dig('unitClasses', 'data', 'unitClasses')
|
67
66
|
id = store_data['number']
|
68
67
|
name = store_data['name']
|
69
68
|
|
70
|
-
address =
|
71
|
-
geocode =
|
72
|
-
prices =
|
69
|
+
address = parse_address(data: store_data)
|
70
|
+
geocode = parse_geocode(data: store_data)
|
71
|
+
prices = parse_prices(data: page_data)
|
73
72
|
|
74
73
|
new(id:, url:, name:, address:, geocode:, prices:)
|
75
74
|
end
|
76
75
|
|
76
|
+
# @param data [Hash]
|
77
|
+
# @return [Address]
|
78
|
+
def self.parse_address(data:)
|
79
|
+
Address.parse(data: data['address'])
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param data [Hash]
|
83
|
+
# @return [Geocode]
|
84
|
+
def self.parse_geocode(data:)
|
85
|
+
Geocode.parse(data: data['geocode'])
|
86
|
+
end
|
87
|
+
|
88
|
+
# @param entries [Array<Hash>]
|
89
|
+
#
|
90
|
+
# @return [Array<Price>]
|
91
|
+
def self.parse_prices(data:)
|
92
|
+
unit_classes = data.dig('unitClasses', 'data', 'unitClasses')
|
93
|
+
|
94
|
+
unit_classes
|
95
|
+
.reject { |price_data| price_data.dig('availability', 'available')&.zero? }
|
96
|
+
.map { |price_data| Price.parse(data: price_data) }
|
97
|
+
end
|
98
|
+
|
77
99
|
# @param document [Nokogiri::HTML::Document]
|
78
100
|
#
|
79
101
|
# @raise [ParseError]
|
data/lib/extraspace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.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: 2025-01-
|
11
|
+
date: 2025-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -115,8 +115,8 @@ licenses:
|
|
115
115
|
metadata:
|
116
116
|
rubygems_mfa_required: 'true'
|
117
117
|
homepage_uri: https://github.com/ksylvest/extraspace
|
118
|
-
source_code_uri: https://github.com/ksylvest/extraspace/tree/v1.0
|
119
|
-
changelog_uri: https://github.com/ksylvest/extraspace/releases/tag/v1.0
|
118
|
+
source_code_uri: https://github.com/ksylvest/extraspace/tree/v1.1.0
|
119
|
+
changelog_uri: https://github.com/ksylvest/extraspace/releases/tag/v1.1.0
|
120
120
|
documentation_uri: https://extraspace.ksylvest.com/
|
121
121
|
post_install_message:
|
122
122
|
rdoc_options: []
|