Class: FineAnts::Adapters::Zillow

Inherits:
Object
  • Object
show all
Defined in:
lib/fine_ants/adapters/zillow.rb

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Zillow

Returns a new instance of Zillow.



6
7
8
# File 'lib/fine_ants/adapters/zillow.rb', line 6

def initialize(credentials)
  @user = credentials[:user]
end

Instance Method Details

#downloadObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fine_ants/adapters/zillow.rb', line 14

def download
  visit "https://www.zillow.com/homedetails/total_nonsense/#{@user}_zpid/?fullpage=true"
  zestimate = find_first(
    ".estimates .home-summary-row:nth-child(2) span:nth-child(2)",
    ".zestimate.primary-quote"
  ).text.match(/(\$.*)/)[1]

  [{
    adapter: :zillow,
    user: @user,
    id: @user,
    name: find_first(".addr h1", ".hdp-home-header-st-addr").text,
    amount: BigDecimal(zestimate.gsub(/[\$,]/, ""))
  }]
end

#loginObject



10
11
12
# File 'lib/fine_ants/adapters/zillow.rb', line 10

def 
  true # No login necessary
end