nsastorage 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4d918b2110c0e1df2d740c64403576da6c632ff1f69d112a891827a0b5aacfc
4
- data.tar.gz: 858a338369573c4b01386d3b6503073d50ec9df7425674194c87d0b85b4712f0
3
+ metadata.gz: 25f9928da25644b2ac5762c8c400bc97d14f75421ea2f6b717931ef3b1de2ac8
4
+ data.tar.gz: 9b561d664872d11ac2478840f8f55c8daeaeef67e1e48d2b509ca033f3cfd0b3
5
5
  SHA512:
6
- metadata.gz: c12176571244e306c3080fc8047e846232c2592caf1be2ddd575ead1f908bba93d7b5bb77adfbd471145fa01619d497b9f0458e27d99af2c9598664a7674b937
7
- data.tar.gz: 36fdf5ba24f0957a001de782db1f55032a86784e2a0efea156db463ab56d2efa13353a9f6d0d64d61b9ef8ab91db4468d2ea6394dd5a7f81f39a0deb8ba1d501
6
+ metadata.gz: 45b801b891ec0be544495c8f766d28e605a933b934d7ff2e8c60fae09480097ab764eca457bc883744c15794b35003479ff1ba45c0fc88a8a2272031f1ed2ac8
7
+ data.tar.gz: 32cd81b1a9a8a3a012e573e87cffadf79c164e4d67b4fe514ee79dd37da901b609e7ea22b6c8a05cd1b7a7526af218dad97fe5921389584fe562eb6b024d44d4
@@ -38,6 +38,11 @@ module NSAStorage
38
38
  "#<#{self.class.name} #{props.join(' ')}>"
39
39
  end
40
40
 
41
+ # @return [String] e.g. "5×5"
42
+ def id
43
+ "#{format('%g', @width)}×#{format('%g', @depth)}"
44
+ end
45
+
41
46
  # @return [Integer]
42
47
  def sqft
43
48
  Integer(@width * @depth)
@@ -10,7 +10,7 @@ module NSAStorage
10
10
  text = element.text
11
11
 
12
12
  new(
13
- climate_controlled: text.include?('Climate controlled'),
13
+ climate_controlled: text.include?('Heated and Cooled'),
14
14
  drive_up_access: text.include?('Drive Up Access'),
15
15
  first_floor_access: text.include?('1st Floor')
16
16
  )
@@ -36,6 +36,15 @@ module NSAStorage
36
36
  "#<#{self.class.name} #{props.join(' ')}>"
37
37
  end
38
38
 
39
+ # @return [String] e.g. ""
40
+ def id
41
+ [].tap do |ids|
42
+ ids << 'cc' if climate_controlled?
43
+ ids << 'dua' if drive_up_access?
44
+ ids << 'ffa' if first_floor_access?
45
+ end.join('-')
46
+ end
47
+
39
48
  # @return [String] e.g. "Climate Controlled + First Floor Access"
40
49
  def text
41
50
  amenities.join(' + ')
@@ -63,12 +63,13 @@ module NSAStorage
63
63
  # @return [Price]
64
64
  def self.parse(element:)
65
65
  link = element.at_xpath(".//a[contains(text(), 'Rent')]|//a[contains(text(), 'Reserve')]")
66
- new(
67
- id: ID_REGEX.match(link['href'])[:id],
68
- dimensions: Dimensions.parse(element:),
69
- features: Features.parse(element:),
70
- rates: Rates.parse(element:)
71
- )
66
+ dimensions = Dimensions.parse(element:)
67
+ features = Features.parse(element:)
68
+ rates = Rates.parse(element:)
69
+
70
+ id = link ? ID_REGEX.match(link['href'])[:id] : "#{dimensions.id}-#{features.id}"
71
+
72
+ new(id:, dimensions:, features:, rates:)
72
73
  end
73
74
  end
74
75
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NSAStorage
4
- VERSION = '0.6.0'
4
+ VERSION = '0.8.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsastorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre