uhaul 1.0.2 → 1.0.3

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: c0f8fc116c731b1c2b29f3cd4035b24a2ad56ca0df78da62271773f531c1c58d
4
- data.tar.gz: efd5b86b8034eb9b3351fba00b0c84d4b055f953efcd9b9c7355c39d53dee495
3
+ metadata.gz: 4acc4dc138e904232902f124d9ee0c78923dc74c609c42515b97e83cdeea3fb2
4
+ data.tar.gz: 9e98885feb0367400d6a444f191b859d2e54abf646c9dda26938545f0d2bf8c6
5
5
  SHA512:
6
- metadata.gz: 1a181386058777f4ab775c3a86a32665ec5f7366be1ea8b30f054c4321960594e6a45a6beaee3011f1fdfaa1dd536e476329f77c94a15319006abf11c41a5c44
7
- data.tar.gz: 0ec03ddbdd12ef8ccfa985ce44f2f8dacceef4f3f3bc595264263e855d6fd8f6fed6c38e5e8cacbe6b72b0a967b3c64f3dc0bf73255821385b74ce1a1e35e3de
6
+ metadata.gz: 3ecf98d2ab243fe983f6ef926c6fd425d988676173892a92990845b489561de61525ea30653d66c1b9d5956842006901064847c46aba4c5b9894c8f1a2846940
7
+ data.tar.gz: dde69a5ed918065d156872112b37b6d67b6f04a462f18f492da53ca7ecd56224ad38d1659f9e0b2bfa86f7e2f79684a0f7cdf391e1dbbece994e80dfec480e40
data/lib/uhaul/price.rb CHANGED
@@ -22,18 +22,6 @@ module UHaul
22
22
  # @return [Rates]
23
23
  attr_accessor :rates
24
24
 
25
- # @param facility_id [Integer]
26
- #
27
- # @return [Array<Price>]
28
- def self.fetch(facility_id:)
29
- url = "https://www.uhaul.com/facility-units/#{facility_id}"
30
- data = Crawler.json(url:)['data']
31
- return [] if data['error']
32
-
33
- html = data['html']['units']
34
- Nokogiri::HTML(html).css(PRICE_SELECTOR).map { |element| parse(element:) }
35
- end
36
-
37
25
  # @param id [String]
38
26
  # @param dimensions [Dimensions]
39
27
  # @param features [Features]
@@ -56,7 +44,7 @@ module UHaul
56
44
  "#<#{self.class.name} #{props.join(' ')}>"
57
45
  end
58
46
 
59
- # @return [String] e.g. "123 | 5' × 5' (25 sqft) | $100 (street) / $90 (web)"
47
+ # @return [String] e.g. "123 | 5' × 5' (25 sqft) | $90"
60
48
  def text
61
49
  "#{@id} | #{@dimensions.text} | #{@rates.text} | #{@features.text}"
62
50
  end
data/lib/uhaul/rates.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module UHaul
4
4
  # The rates (street + web) for a facility
5
5
  class Rates
6
- RATE_REGEX = /\$(?<price>[\d\.]+) Per Month/
6
+ RATE_REGEX = /\$(?<price>[\d\.\,]+) Per Month/
7
7
 
8
8
  # @attribute [rw] rate
9
9
  # @return [Integer]
@@ -16,7 +16,7 @@ module UHaul
16
16
  #
17
17
  # @return [Rates]
18
18
  def self.parse(text:)
19
- price = Float(RATE_REGEX.match(text)[:price])
19
+ price = Float(RATE_REGEX.match(text)[:price].gsub(',', ''))
20
20
 
21
21
  new(price:)
22
22
  end
data/lib/uhaul/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UHaul
4
- VERSION = '1.0.2'
4
+ VERSION = '1.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uhaul
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre