nsastorage 0.6.0 → 0.7.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: 9537a3d82172d34af175389d2d2cc33b6fa965fd0417b063895214f07f93d332
4
+ data.tar.gz: 5b22a92987bf74ab7ec95e7a834a2abb8221df44023594309bb38b0de0714696
5
5
  SHA512:
6
- metadata.gz: c12176571244e306c3080fc8047e846232c2592caf1be2ddd575ead1f908bba93d7b5bb77adfbd471145fa01619d497b9f0458e27d99af2c9598664a7674b937
7
- data.tar.gz: 36fdf5ba24f0957a001de782db1f55032a86784e2a0efea156db463ab56d2efa13353a9f6d0d64d61b9ef8ab91db4468d2ea6394dd5a7f81f39a0deb8ba1d501
6
+ metadata.gz: 19bb2a9780263f76146e6336c576d6134831697fb5cf736afe7ded2cda33dea6921848bf3b8794fd4189c3a2328cf9fa3ff80df1a0005484053085b73896f8f4
7
+ data.tar.gz: 804bc7dba4e357e73700fa4b41e765a8c7f4de4606fd310d33eb68724eb454409dff6715eebabd9eb764a77ca96fef1977edf2c31214af943b05bc4f48301cb7
@@ -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)
@@ -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.7.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.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre