nsastorage 0.2.0 → 0.4.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: 6bf4dc5114c043fc32d886eb98d630f24bfff9d3ccefbdd3a92b006c3cb967d4
4
- data.tar.gz: c81742bdf7d0d35c5dc23b2584ad10d47b370a1de6e564e08233ed9db7b21538
3
+ metadata.gz: 53128971c4bb0dae9a2b76344d4dc84ac86293920d4ddcf21e3addeb8ecb7e81
4
+ data.tar.gz: cf0483911e2f2aae47f3bd80b4c14337688d920c4712e7862ea4ceeba1e1b734
5
5
  SHA512:
6
- metadata.gz: 801e52c62bdac13fcc9338496e47d866bb8392cf7b988b2535596963c5030bc90a5400ce7ad173d71e4a7cac61a89c0a196f0d064115431219fe5301167b9f2e
7
- data.tar.gz: ad2da5dfc46c674e85bc310312f6e30feb65f19df3036ce0ba91ee16bd5676c30fe1e5d75241a2e0bbaf7fcd79d67034360455cd00f95ebcf3f31294feff0d94
6
+ metadata.gz: 6444fea2908d37b7363557bfd2381564c4fd51f27283acb596d768d8dabf5bb04b4eda29929e4e71a088b05e9100cd3219efdd245525dda4e5026df7a044a24b
7
+ data.tar.gz: 1cdc3d5f72ac6a175df7568a0b9eaac067d6f1e782c14452c9a6e02146302743c715063f70bc90722799f878f14fb884aba977f6a4e9b7695d6a188166ed7dad
@@ -4,6 +4,8 @@ module NSAStorage
4
4
  # The price (id + dimensions + rate) for a facility.
5
5
  class Price
6
6
  ID_REGEX = %r{(?<id>\d+)/rent/}
7
+ PRICE_SELECTOR = '[data-unit-size="small"],[data-unit-size="medium"],[data-unit-size="large"]'
8
+
7
9
  # @attribute [rw] id
8
10
  # @return [String]
9
11
  attr_accessor :id
@@ -26,7 +28,7 @@ module NSAStorage
26
28
  def self.fetch(facility_id:)
27
29
  url = "https://www.nsastorage.com/facility-units/#{facility_id}"
28
30
  html = Crawler.json(url:)['data']['html']['units']
29
- Nokogiri::HTML(html).css('[data-unit-size]').map { |element| parse(element:) }
31
+ Nokogiri::HTML(html).css(PRICE_SELECTOR).map { |element| parse(element:) }
30
32
  end
31
33
 
32
34
  # @param id [String]
@@ -60,7 +62,7 @@ module NSAStorage
60
62
  #
61
63
  # @return [Price]
62
64
  def self.parse(element:)
63
- link = element.at_xpath("//a[contains(text(), 'Rent')]")
65
+ link = element.at_xpath("//a[contains(text(), 'Rent')]|//a[contains(text(), 'Reserve')]")
64
66
  new(
65
67
  id: ID_REGEX.match(link['href'])[:id],
66
68
  dimensions: Dimensions.parse(element:),
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NSAStorage
4
- VERSION = '0.2.0'
4
+ VERSION = '0.4.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.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre