remora 0.0.1 → 0.0.2

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: 48c785686f8563c72d5111876b148884307951ee
4
- data.tar.gz: ba09c9430cd89b174381addc84779665a220c51e
3
+ metadata.gz: 291bf3a2cefdc9a5d586fbfc07dffe8368dccef2
4
+ data.tar.gz: 2a3d936a163e329ad8f749b5fd32b4399054652e
5
5
  SHA512:
6
- metadata.gz: 0cf5e6168ab064999a62c7a90f065d88de3e793a0377d2901e99316ef83e10906ef4785ba8c262572a98e6c9266d139590ff333031fb79952ca78f891f200de6
7
- data.tar.gz: 0917d2df75b6e8708846841c054841f9f9a80e1bacb72288b252a4da49d02b1186a1857ea224bd43864fcc57931f397251539387fb935956621580b2a745fc0a
6
+ metadata.gz: d0f52795762de523872ee86fc84e7b71a7462f719002f2fb5738fc19c198f65976b58a0b5899e380ba9a96eaca8b0e0369eca2ea61c0ed8868f87ef75c694ad0
7
+ data.tar.gz: 4f6b7f40fcdf94fd399e0718fd7296d5b3e9dec65bd7d1be76e78dab3b7185740a3f8be49e01c3baeea6738faebb486b800e1966bbb104b3d22a9e52ac2ec041
@@ -1,3 +1,3 @@
1
1
  module Remora
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/remora.rb CHANGED
@@ -31,10 +31,14 @@ module Remora
31
31
  def reports_left
32
32
  resp = @agent.get("http://www.propertyshark.com/mason/Accounts/My/")
33
33
  doc = Nokogiri::parse(resp.body)
34
- doc
35
- .css(".my-subscriptions")[0]
36
- .css(".details span")[-3]
37
- .text().strip
34
+ begin
35
+ doc
36
+ .css(".my-subscriptions")[0]
37
+ .css(".details span")[-3]
38
+ .text().strip
39
+ rescue NoMethodError => error
40
+ "0/200"
41
+ end
38
42
  end
39
43
  def search_in_sf(address)
40
44
  response = @agent.get("http://www.propertyshark.com/mason/ca/San-Francisco-County/Property-Search")
@@ -109,6 +113,22 @@ module Remora
109
113
  location:"San Francisco County, CA"
110
114
  }
111
115
 
116
+ request_search_by_name(search_form)
117
+ end
118
+ def search_by_name_in_la(name)
119
+ response = @agent.get("http://www.propertyshark.com/mason/ca/Los-Angeles-County/Property-Search")
120
+
121
+ search_form = {
122
+ search_type:"owner",
123
+ search_types_selector:"owner",
124
+ search_token: name,
125
+ location:"Los Angeles County, CA"
126
+ }
127
+ request_search_by_name(search_form)
128
+ end
129
+
130
+ private
131
+ def request_search_by_name(search_form)
112
132
  resp = @agent.post("http://www.propertyshark.com/mason/UI/homepage_search.html",search_form)
113
133
 
114
134
  doc = Nokogiri::parse(resp.body)
@@ -120,6 +140,7 @@ module Remora
120
140
  results.map do |result|
121
141
  {
122
142
  address: result.css("td.first span.big_font").text().strip(),
143
+ city: (result.css("td.first b").text().split(",").shift()||"").strip(),
123
144
  owner: result.css(".single_line:first-child").text().strip()
124
145
  }
125
146
  end
data/spec/remora_spec.rb CHANGED
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Remora do
4
4
  before do
5
- email = ENV['email']||"YOUREMAILHERE"
6
- password = ENV['password']||"YOURPASSWORDHERE"
5
+ email = ENV['EMAIL']||"YOUREMAILHERE"
6
+ password = ENV['PASSWORD']||"YOURPASSWORDHERE"
7
7
  @shark = Remora::Remora.new(email, password)
8
8
  end
9
9
  describe '.my_name_is' do
@@ -57,7 +57,7 @@ describe Remora do
57
57
  context 'just a last name' do
58
58
  it 'the Steins' do
59
59
  properties = @shark.search_by_name_in_sf("Stein")
60
- expect(properties.length).to eq(128)
60
+ expect(properties.length).to be > (128)
61
61
 
62
62
  expect(properties[0][:address]).to eq("954 De Haro St")
63
63
  expect(properties[0][:owner]).to eq("Stein Quinton F Herz")
@@ -70,5 +70,16 @@ describe Remora do
70
70
  end
71
71
  end
72
72
  end
73
+ describe '.search_by_name_in_la' do
74
+ context 'a person has one property' do
75
+ it 'the Shelley Jo Evans Trustee' do
76
+ properties = @shark.search_by_name_in_la("Shelley Jo Evans Trustee")
77
+ expect(properties.length).to eq(1)
78
+ expect(properties[0][:address]).to eq("9528 Wendon St")
79
+ expect(properties[0][:owner]).to eq("Evans Shelley Jo Trustee")
80
+ expect(properties[0][:city]).to eq("Temple City")
81
+ end
82
+ end
83
+ end
73
84
  end
74
85
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-09 00:00:00.000000000 Z
11
+ date: 2015-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
228
  - an account at propertyshark
229
229
  rubyforge_project:
230
- rubygems_version: 2.3.0
230
+ rubygems_version: 2.4.4
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: Lightweight gem to discover information about San Francisco real estate via