fine_ants 1.8.4 → 1.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c696425121559daeacb3e07448c12e2ead130762
4
- data.tar.gz: 9f350ed3862b9bf87b004975805222c017509b62
3
+ metadata.gz: e1172b4e3fe328425ef87e41caec3a2c211c19eb
4
+ data.tar.gz: fe2e980bee738c6800b35ee3a733253711e3fdb7
5
5
  SHA512:
6
- metadata.gz: f4ca00c6c6ef33c04f4c66ea8aa5f67534c3df54d58a6d19bd13b608471e0423c89f7bb6158e31621141408a4ccef0f94ecc1fdf14e7938d0b8d77ce88624520
7
- data.tar.gz: 34200cc91f07359a6f730ad7f8fa4ddfbbf79b743848786e5dc164d7a6aa7f665993ea0c0e73473b2cb11386d7d058bbd0f576ac0d2b553350bb324c8120871b
6
+ metadata.gz: f0af24a4bbdd5e9927bb0f7b61d61990887ba58776ec62659126400747ec8e2b4720bc403cb2c49e42d4264c82d7f8c5e822a8df2739b4c38cf405be4cd8e529
7
+ data.tar.gz: 1b11dfdc0670d498d95ea2b52fe26c7c270ee866e6863a613ac9a92647f5fe800ece4276fbeeb0b5fe23235cbf0b332ba58f580934b512ce81d9b22fbde88d6c
@@ -14,7 +14,7 @@ module FineAnts
14
14
  within form_css do
15
15
  fill_in "User ID", :with => @user
16
16
  fill_in "Password", :with => @password
17
- click_link "Log In"
17
+ click_thing "Log In"
18
18
  end
19
19
  verify_login!
20
20
  end
@@ -49,6 +49,12 @@ module FineAnts
49
49
  rescue
50
50
  raise FineAnts::LoginFailedError.new
51
51
  end
52
+
53
+ def click_thing(locator)
54
+ click_link locator
55
+ rescue
56
+ click_button locator
57
+ end
52
58
  end
53
59
  end
54
60
  end
@@ -46,7 +46,7 @@ module FineAnts
46
46
  private
47
47
 
48
48
  def verify_login!
49
- find ".lastLogon"
49
+ find_link "Log off"
50
50
  rescue Capybara::ElementNotFound
51
51
  raise FineAnts::LoginFailedError.new
52
52
  end
@@ -13,15 +13,30 @@ module FineAnts
13
13
 
14
14
  def download
15
15
  visit "https://www.zillow.com/homedetails/total_nonsense/#{@user}_zpid/?fullpage=true"
16
- zestimate = find('.estimates .home-summary-row:nth-child(2) span:nth-child(2)').text
16
+ zestimate = find_first(
17
+ '.estimates .home-summary-row:nth-child(2) span:nth-child(2)',
18
+ '.zestimate.primary-quote'
19
+ ).text.match(/(\$.*)/)[1]
20
+
17
21
  [{
18
22
  :adapter => :zillow,
19
23
  :user => @user,
20
24
  :id => @user,
21
- :name => find('.addr h1').text,
25
+ :name => find_first('.addr h1', '.hdp-home-header-st-addr').text,
22
26
  :amount => BigDecimal.new(zestimate.gsub(/[\$,]/,''))
23
27
  }]
24
28
  end
29
+
30
+ private
31
+
32
+ def find_first(*locators)
33
+ locators.each do |locator|
34
+ begin
35
+ return find(locator)
36
+ rescue Capybara::ElementNotFound
37
+ end
38
+ end
39
+ end
25
40
  end
26
41
  end
27
42
  end
@@ -1,3 +1,3 @@
1
1
  module FineAnts
2
- VERSION = "1.8.4"
2
+ VERSION = "1.8.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fine_ants
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-21 00:00:00.000000000 Z
11
+ date: 2017-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara