fma_realestate 0.1.0 → 0.2.0

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: c85b2b133e4ffb9894d542a7004a4e7b37fda1df
4
- data.tar.gz: 3190a4aaaca7faf5f969ddfd7d5d8173e108183e
3
+ metadata.gz: aaad689035e482749a74c8db4fcbc6ad257756b5
4
+ data.tar.gz: e3536ea650c373718ba29b1ebf377da8f83240c4
5
5
  SHA512:
6
- metadata.gz: 1643524c0b314960ccb8a8fb81ca96698875b79e034b1eeb23ad39e5fdd2acff8f1007eed85348b4944151312a311cfdf384fbfeefee05c3877276d13d8b1159
7
- data.tar.gz: af381df429c434bf77c009ba676925c17452027db353a75d61afeb53b91c4820830bb054bc6c8a95fe1dfb7775119c144574459a9e57f8fa62ce3ba72b5c5b1a
6
+ metadata.gz: 9ce99a1d4d0e693c72b1e19ac828670ccae95348ab2da64327454819ecdbb220870811122cf5e97c433608d4d2eea8770a40a7a6230de679218805aba720f883
7
+ data.tar.gz: 0c57b5bf3c61d48e526c3c9b1f012e32ab456b1a051e8a60137e1eef04702bcd8ea001d18736334ec54548b6b9242104e2bb1e7eda2d32fba1f24aab3f87cbc7
data/README.md CHANGED
@@ -50,21 +50,47 @@ config = {
50
50
 
51
51
  ```ruby
52
52
  # Example Cass client usage
53
- cass_client = Cass.new # using default config
54
- response_hash = cass_client.tiger(
53
+ client = Cass.new # using default config
54
+
55
+ # Cass#tiger
56
+ response_hash = client.tiger(
55
57
  :street_address => "123 N Easy St.", # optional
56
58
  :city => "Boulder", # optional
57
59
  :state => "CO", # optional
58
60
  :zip => "" # optional
59
61
  )
62
+
63
+ # Cass#address
64
+ response_hash = client.address(
65
+ :street_address => "123 N Easy St.", # optional
66
+ :city => "Boulder", # optional
67
+ :state => "CO", # optional
68
+ :zip => "" # optional
69
+ )
70
+
71
+ # Cass#city_zip
72
+ response_hash = client.city_zip(
73
+ :city => "Boulder", # optional
74
+ :state => "CO", # optional
75
+ )
76
+
77
+ # Cass#city_county
78
+ response_hash = client.city_county(
79
+ :zip => "80302" # optional
80
+ )
81
+
82
+ # Cass#state_county
83
+ response_hash = client.state_county(
84
+ :state => "CO", # optional
85
+ )
60
86
  ```
61
87
 
62
88
  ```ruby
63
89
  # Example PublicRecord client usage
64
- public_record_client = RealEstate.new # using default config
90
+ client = PublicRecord.new # using default config
65
91
 
66
92
  # PublicRecord#search_by_address
67
- response_hash = public_record_client.search_by_address(
93
+ response_hash = client.search_by_address(
68
94
  :street_address => "123 N Easy St.", # optional
69
95
  :city => "Boulder", # optional
70
96
  :state => "CO", # optional
@@ -72,7 +98,7 @@ response_hash = public_record_client.search_by_address(
72
98
  )
73
99
 
74
100
  # PublicRecord#search_by_advanced
75
- response_hash = public_record_client.search_by_advanced(
101
+ response_hash = client.search_by_advanced(
76
102
  :legal_description => "" # optional
77
103
  :owner_name => "Jon Doe" # optional
78
104
  :street_address => "123 N Easy St.", # optional
@@ -83,7 +109,7 @@ response_hash = public_record_client.search_by_advanced(
83
109
  )
84
110
 
85
111
  # PublicRecord#search_by_address_advanced
86
- response_hash = public_record_client.search_by_address_advanced(
112
+ response_hash = client.search_by_address_advanced(
87
113
  :legal_description => "" # optional
88
114
  :owner_name => "Jon Doe" # optional
89
115
  :street_address => "123 N Easy St.", # optional
@@ -94,11 +120,21 @@ response_hash = public_record_client.search_by_address_advanced(
94
120
  )
95
121
 
96
122
  # PublicRecord#search_by_global
97
- response_hash = public_record_client.search_by_address_advanced(
123
+ response_hash = client.search_by_address_advanced(
98
124
  :q => "123 N Easy St." # required
99
125
  )
100
126
  ```
101
127
 
128
+ ```ruby
129
+ # Example PublicRecordSale client usage
130
+ client = PublicRecordSale.new # using default config
131
+
132
+ # PublicRecord#search_by_cass_search_key
133
+ response_hash = client.search_by_cass_search_key(
134
+ :street_address => "90803513805UNIT405", # optional
135
+ )
136
+ ```
137
+
102
138
  ## FmaRealstate API Reference
103
139
  Please refer to the <a href="http://realestate.firstmoversadvantage.com/api_documentation" target="_blank">official api documentation</a>
104
140
 
@@ -5,6 +5,7 @@ require "fma_realestate/version"
5
5
  require "fma_realestate/client"
6
6
  require "fma_realestate/cass"
7
7
  require "fma_realestate/public_record"
8
+ require "fma_realestate/public_record_sale"
8
9
  require "fma_realestate/exceptions"
9
10
 
10
11
  module FmaRealestate
@@ -3,5 +3,21 @@ module FmaRealestate
3
3
  def tiger(params={})
4
4
  get('/api/cass/tiger', params)
5
5
  end
6
+
7
+ def address(params={})
8
+ get('/api/cass/address', params)
9
+ end
10
+
11
+ def city_zip(params={})
12
+ get('/api/cass/city_zip', params)
13
+ end
14
+
15
+ def city_county(params={})
16
+ get('/api/cass/city_county', params)
17
+ end
18
+
19
+ def state_county(params={})
20
+ get('/api/cass/state_county', params)
21
+ end
6
22
  end
7
23
  end
@@ -0,0 +1,7 @@
1
+ module FmaRealestate
2
+ class PublicRecordSale < Client
3
+ def search_by_cass_search_key(params={})
4
+ get('/api/public_record_sales/search_by_cass_search_key', params)
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module FmaRealestate
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,26 @@
1
+ {
2
+ "address_type": "S",
3
+ "city": "Boulder",
4
+ "county_name": "Boulder",
5
+ "county_number": "013",
6
+ "dpbc": "25",
7
+ "dpv_confirmation_indicator": "Y",
8
+ "in_street_address": "1325 pearl street",
9
+ "in_city": "Boulder",
10
+ "in_state": "CO",
11
+ "in_zip": "80302",
12
+ "post_directional": "",
13
+ "pre_directional": "",
14
+ "return_code": "1",
15
+ "search_key": "80302524725",
16
+ "state": "CO",
17
+ "street_address": "1325 Pearl St",
18
+ "street_name": "PEARL",
19
+ "street_number": "1325",
20
+ "street_suffix": "ST",
21
+ "unit_number": "",
22
+ "unit_type": "",
23
+ "zip_4": "5247",
24
+ "zip_5": "80302",
25
+ "zip_9": "80302-5247"
26
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "city": "BOULDER",
3
+ "county_name": "BOULDER",
4
+ "county_number": "013",
5
+ "return_code": "0",
6
+ "state": "CO"
7
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "city": "Boulder",
3
+ "return_code": "11",
4
+ "state": "CO",
5
+ "zips": ["80301","80302","80303","80304","80305","80306","80307","80308","80309","80310","80314"]
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "county_names": ["ADAMS","ALAMOSA","ARAPAHOE","ARCHULETA","BACA","BENT","BOULDER","BROOMFIELD","CHAFFEE","CHEYENNE","CLEAR CREEK","CONEJOS","COSTILLA","CROWLEY","CUSTER","DELTA","DENVER","DOLORES","DOUGLAS","EAGLE","ELBERT","EL PASO","FREMONT","GARFIELD","GILPIN","GRAND","GUNNISON","HINSDALE","HUERFANO","JACKSON","JEFFERSON","KIOWA","KIT CARSON","LAKE","LA PLATA","LARIMER","LAS ANIMAS","LINCOLN","LOGAN","MESA","MINERAL","MOFFAT","MONTEZUMA","MONTROSE","MORGAN","OTERO","OURAY","PARK","PHILLIPS","PITKIN","PROWERS","PUEBLO","RIO BLANCO","RIO GRANDE","ROUTT","SAGUACHE","SAN JUAN","SAN MIGUEL","SEDGWICK","SUMMIT","TELLER","WASHINGTON","WELD","YUMA"],
3
+ "county_numbers": ["001","003","005","007","009","011","013","014","015","017","019","021","023","025","027","029","031","033","035","037","039","041","043","045","047","049","051","053","055","057","059","061","063","065","067","069","071","073","075","077","079","081","083","085","087","089","091","093","095","097","099","101","103","105","107","109","111","113","115","117","119","121","123","125"],
4
+ "return_code": "64",
5
+ "state": "CO"
6
+ }
@@ -0,0 +1,212 @@
1
+ {
2
+ "count": 1,
3
+ "results": [
4
+ {
5
+ "id": 6001,
6
+ "sa_property_id": 32371100,
7
+ "sa_scm_id": 49,
8
+ "mm_state_code": "CA",
9
+ "mm_muni_name": "LOS ANGELES",
10
+ "mm_fips_state_code": "06",
11
+ "mm_fips_muni_code": "037",
12
+ "mm_fips_county_name": "LOS ANGELES",
13
+ "sa_parcel_nbr_primary": "7264026081",
14
+ "sa_parcel_nbr_reference": "",
15
+ "sa_parcel_account_nbr": "",
16
+ "sa_parcel_nbr_alt": "",
17
+ "sa_parcel_nbr_previous": "",
18
+ "sa_parcel_nbr_change_yr": "0",
19
+ "sa_yr_apn_added": "0",
20
+ "sa_owner_1": "ECHTERNACH,ELIZABETH W",
21
+ "sa_owner_1_first": "ELIZABETH",
22
+ "sa_owner_1_mid": "W",
23
+ "sa_owner_1_last": "ECHTERNACH",
24
+ "sa_owner_1_suf": "",
25
+ "sa_owner_1_sp_first": "",
26
+ "sa_owner_1_sp_mid": "",
27
+ "sa_owner_1_sp_suf": "",
28
+ "sa_owner_1_group": "",
29
+ "sa_owner_1_et_flag": "",
30
+ "sa_owner_1_trust_flag": "",
31
+ "sa_owner_1_type": "0",
32
+ "sa_owner_2": "",
33
+ "sa_owner_2_first": "",
34
+ "sa_owner_2_mid": "",
35
+ "sa_owner_2_last": "",
36
+ "sa_owner_2_suf": "",
37
+ "sa_owner_2_sp_first": "",
38
+ "sa_owner_2_sp_mid": "",
39
+ "sa_owner_2_sp_suf": "",
40
+ "sa_owner_2_group": "",
41
+ "sa_owner_2_et_flag": "",
42
+ "sa_owner_2_trust_flag": "",
43
+ "sa_owner_2_type": "",
44
+ "sa_ownership_status_code": "",
45
+ "sa_company_flag": "",
46
+ "sa_site_house_nbr": "2500",
47
+ "sa_site_fraction": "",
48
+ "sa_site_dir": "E",
49
+ "sa_site_street_name": "2ND",
50
+ "sa_site_suf": "ST",
51
+ "sa_site_post_dir": "",
52
+ "sa_site_unit_pre": "UNIT",
53
+ "sa_site_unit_val": "405",
54
+ "sa_site_city": "LONG BEACH",
55
+ "sa_site_state": "CA",
56
+ "sa_site_zip": "90803",
57
+ "sa_site_plus_4": "5138",
58
+ "sa_site_crrt": "C031",
59
+ "sa_mail_house_nbr": "4220",
60
+ "sa_mail_fraction": "",
61
+ "sa_mail_dir": "N",
62
+ "sa_mail_street_name": "VIRGINIA",
63
+ "sa_mail_suf": "VIS",
64
+ "sa_mail_post_dir": "",
65
+ "sa_mail_unit_pre": "",
66
+ "sa_mail_unit_val": "",
67
+ "sa_mail_city": "LONG BEACH",
68
+ "sa_mail_state": "CA",
69
+ "sa_mail_zip": "90807",
70
+ "sa_mail_plus_4": "3123",
71
+ "sa_mail_crrt": "C006",
72
+ "sa_site_mail_same": "N",
73
+ "sa_lgl_dscrptn": "TRACT NO 28132 CONDOMINIUM UNITS 65 AND 20",
74
+ "sa_lot_nbr_1": "",
75
+ "sa_lot_nbr_2": "",
76
+ "sa_lot_nbr_3": "",
77
+ "sa_blk_nbr_1": "",
78
+ "sa_blk_nbr_2": "",
79
+ "sa_township": "",
80
+ "sa_range": "",
81
+ "sa_section": "",
82
+ "sa_quarter": "",
83
+ "sa_quarter_quarter": "",
84
+ "sa_subdivision": "28132",
85
+ "sa_tract_nbr": "28132",
86
+ "sa_lgl_unit": "",
87
+ "use_code_std": "RCON",
88
+ "use_code_muni": "010C",
89
+ "sa_zoning": "LBR2L",
90
+ "assr_year": "2013",
91
+ "sa_val_assd": "183000",
92
+ "sa_val_assd_land": "139500",
93
+ "sa_val_assd_imprv": "43500",
94
+ "sa_imprv_pct": "23.77",
95
+ "sa_appraise_yr": "2013",
96
+ "sa_yr_land_appraise": "2013",
97
+ "sa_appraise_val": "0",
98
+ "sa_val_appraise_land": "0",
99
+ "sa_val_appraise_imprv": "0",
100
+ "sa_imprv_pct_appraise": "",
101
+ "sa_val_market": "0",
102
+ "sa_val_market_land": "0",
103
+ "sa_val_market_imprv": "0",
104
+ "sa_imprv_pct_mrkt": "",
105
+ "sa_exemp_flag_1": "",
106
+ "sa_exemp_val_1": "0",
107
+ "sa_exemp_flag_2": "",
108
+ "sa_exemp_val_2": "0",
109
+ "sa_exemp_flag_3": "",
110
+ "sa_exemp_val_3": "0",
111
+ "sa_exemp_flag_4": "",
112
+ "sa_exemp_val_4": "0",
113
+ "sa_exemp_flag_5": "",
114
+ "sa_exemp_val_5": "0",
115
+ "sa_exemp_flag_6": "",
116
+ "sa_exemp_val_6": "0",
117
+ "sa_val_full_cash": "0",
118
+ "sa_val_assd_prev": "223000",
119
+ "taxyear": "2013",
120
+ "sa_tax_val": "2199.91",
121
+ "sa_tax_year_delinq": "0",
122
+ "last_assr_upd": "20131004",
123
+ "last_tax_updt": "20140225",
124
+ "sa_addtns_sqft": "0",
125
+ "sa_architecture_code": "",
126
+ "sa_attic_sqft": "0",
127
+ "sa_bldg_code": "",
128
+ "sa_bldg_shape_code": "0",
129
+ "sa_bldg_sqft": "0",
130
+ "sa_bsmt_2_code": "",
131
+ "sa_bsmt_fin_sqft": "0",
132
+ "sa_bsmt_unfin_sqft": "0",
133
+ "sa_condition_code": "0.0",
134
+ "sa_construction_code": "0",
135
+ "sa_construction_qlty": "0.0",
136
+ "sa_cool_code": "",
137
+ "sa_exterior_1_code": "",
138
+ "sa_fin_sqft_1": "0",
139
+ "sa_fin_sqft_2": "0",
140
+ "sa_fin_sqft_3": "0",
141
+ "sa_fin_sqft_4": "0",
142
+ "sa_fin_sqft_tot": "700",
143
+ "sa_fireplace_code": "",
144
+ "sa_foundation_code": "",
145
+ "sa_garage_carport": "",
146
+ "sa_grg_1_code": "",
147
+ "sa_grg_sqft_1": "0",
148
+ "sa_heat_code": "8",
149
+ "sa_heat_src_fuel_code": "",
150
+ "sa_lot_depth": "0",
151
+ "sa_lot_width": "0",
152
+ "sa_lotsize": "14964.0000",
153
+ "sa_nbr_bath": "1.00",
154
+ "sa_nbr_bath_1qtr": "0",
155
+ "sa_nbr_bath_half": "0",
156
+ "sa_nbr_bath_3qtr": "0",
157
+ "sa_nbr_bath_full": "0",
158
+ "sa_nbr_bath_bsmt_half": "0",
159
+ "sa_nbr_bath_bsmt_full": "0",
160
+ "sa_nbr_bath_dq": "0.00",
161
+ "sa_nbr_bedrms": "1",
162
+ "sa_nbr_rms": "0",
163
+ "sa_nbr_stories": "0",
164
+ "sa_nbr_units": "1",
165
+ "sa_patio_porch_code": "",
166
+ "sa_pool_code": "",
167
+ "sa_privacy_code": "",
168
+ "sa_roof_code": "",
169
+ "sa_sqft": "700",
170
+ "sa_sqft_assr_tot": "0",
171
+ "sa_sqft_dq": "1",
172
+ "sa_structure_code": "",
173
+ "sa_structure_nbr": "1",
174
+ "sa_view_code": "",
175
+ "sa_yr_blt": "1968",
176
+ "sa_yr_blt_effect": "1968",
177
+ "sr_unique_id": "150861962",
178
+ "sr_unique_id_noval": "332359446",
179
+ "sa_date_transfer": "20050208",
180
+ "sa_val_transfer": "306000",
181
+ "sa_doc_nbr_fmt": "0000290218",
182
+ "sa_date_noval_transfer": "20120622",
183
+ "sa_doc_nbr_noval": "0000933347",
184
+ "process_id": "145284",
185
+ "sa_x_coord": "-118.162287",
186
+ "sa_y_coord": "33.76523",
187
+ "sa_geo_qlty_code": "0",
188
+ "sa_census_tract": "576700",
189
+ "sa_census_block_group": "3",
190
+ "core_based_statistical_area_code": "31100",
191
+ "minor_civil_division_code": "91730",
192
+ "fips_place_code": "43000",
193
+ "sa_inactive_parcel_flag": "",
194
+ "sa_shell_parcel_flag": "",
195
+ "cass_street_address": "2500 E 2nd St Unit 405",
196
+ "cass_city": "Long Beach",
197
+ "cass_state": "CA",
198
+ "cass_zip_5": "90803",
199
+ "cass_zip_4": "5138",
200
+ "cass_dpbc": "05",
201
+ "cass_unit_type": "UNIT",
202
+ "cass_unit_number": "405",
203
+ "cass_search_key": "90803513805UNIT405",
204
+ "cass_return_code": 1,
205
+ "cass_updated_on": "2015-01-29",
206
+ "latitude": "33.765408",
207
+ "longitude": "-118.1616",
208
+ "created_at": "2015-01-29T23:54:36.000Z",
209
+ "updated_at": "2015-01-29T23:54:36.000Z"
210
+ }
211
+ ]
212
+ }
@@ -33,7 +33,7 @@ describe FmaRealestate::Cass do
33
33
  end
34
34
 
35
35
  context "with valid access_token" do
36
- let(:fixture) { request_fixture('tiger') }
36
+ let(:fixture) { request_fixture('cass/tiger') }
37
37
  it "should get response" do
38
38
  Excon.stub({ :method => :get, :path => '/api/cass/tiger', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
39
39
  params = {:street_address => "1325 Pearl Street", :city => "Boulder", :state => "CO", :zip => "80302"}
@@ -44,4 +44,165 @@ describe FmaRealestate::Cass do
44
44
  end
45
45
  end
46
46
  end
47
+
48
+ describe "#address" do
49
+ context "with :raise_errors => false" do
50
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => false) }
51
+
52
+ it_behaves_like "handles error suppression" do
53
+ let(:action) { authenticated_client.address }
54
+ end
55
+ end
56
+
57
+ context "with :raise_errors => true" do
58
+
59
+ it_behaves_like "requires valid authentication" do
60
+ let(:action) { anonymous_client.address }
61
+ end
62
+
63
+ it_behaves_like "handles 404 response" do
64
+ let(:action) { authenticated_client.address }
65
+ end
66
+
67
+ it_behaves_like "handles 400 response" do
68
+ let(:action) { authenticated_client.address }
69
+ end
70
+
71
+ it_behaves_like "handles 400 response" do
72
+ let(:action) { authenticated_client.address }
73
+ end
74
+ end
75
+
76
+ context "with valid access_token" do
77
+ let(:fixture) { request_fixture('cass/address') }
78
+ it "should get response" do
79
+ Excon.stub({ :method => :get, :path => '/api/cass/address', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
80
+ params = {:street_address => "1325 Pearl Street", :city => "Boulder", :state => "CO", :zip => "80302"}
81
+ response = authenticated_client.address(params)
82
+ expect(response.keys.count).to eq(24)
83
+ expect(response['return_code']).to eq('1')
84
+ expect(response['dpv_confirmation_indicator']).to eq('Y')
85
+ end
86
+ end
87
+ end
88
+
89
+ describe "#city_zip" do
90
+ context "with :raise_errors => false" do
91
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => false) }
92
+
93
+ it_behaves_like "handles error suppression" do
94
+ let(:action) { authenticated_client.city_zip }
95
+ end
96
+ end
97
+
98
+ context "with :raise_errors => true" do
99
+
100
+ it_behaves_like "requires valid authentication" do
101
+ let(:action) { anonymous_client.city_zip }
102
+ end
103
+
104
+ it_behaves_like "handles 404 response" do
105
+ let(:action) { authenticated_client.city_zip }
106
+ end
107
+
108
+ it_behaves_like "handles 400 response" do
109
+ let(:action) { authenticated_client.city_zip }
110
+ end
111
+
112
+ it_behaves_like "handles 400 response" do
113
+ let(:action) { authenticated_client.city_zip }
114
+ end
115
+ end
116
+
117
+ context "with valid access_token" do
118
+ let(:fixture) { request_fixture('cass/city_zip') }
119
+ it "should get response" do
120
+ Excon.stub({ :method => :get, :path => '/api/cass/city_zip', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
121
+ params = {:city => "Boulder", :state => "CO"}
122
+ response = authenticated_client.city_zip(params)
123
+ expect(response.keys.count).to eq(4)
124
+ expect(response['return_code']).to eq('11')
125
+ end
126
+ end
127
+ end
128
+
129
+ describe "#city_county" do
130
+ context "with :raise_errors => false" do
131
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => false) }
132
+
133
+ it_behaves_like "handles error suppression" do
134
+ let(:action) { authenticated_client.city_county }
135
+ end
136
+ end
137
+
138
+ context "with :raise_errors => true" do
139
+
140
+ it_behaves_like "requires valid authentication" do
141
+ let(:action) { anonymous_client.city_county }
142
+ end
143
+
144
+ it_behaves_like "handles 404 response" do
145
+ let(:action) { authenticated_client.city_county }
146
+ end
147
+
148
+ it_behaves_like "handles 400 response" do
149
+ let(:action) { authenticated_client.city_county }
150
+ end
151
+
152
+ it_behaves_like "handles 400 response" do
153
+ let(:action) { authenticated_client.city_county }
154
+ end
155
+ end
156
+
157
+ context "with valid access_token" do
158
+ let(:fixture) { request_fixture('cass/city_county') }
159
+ it "should get response" do
160
+ Excon.stub({ :method => :get, :path => '/api/cass/city_county', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
161
+ params = {:zip => "80302"}
162
+ response = authenticated_client.city_county(params)
163
+ expect(response.keys.count).to eq(5)
164
+ expect(response['return_code']).to eq('0')
165
+ end
166
+ end
167
+ end
168
+
169
+ describe "#state_county" do
170
+ context "with :raise_errors => false" do
171
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => false) }
172
+
173
+ it_behaves_like "handles error suppression" do
174
+ let(:action) { authenticated_client.state_county }
175
+ end
176
+ end
177
+
178
+ context "with :raise_errors => true" do
179
+
180
+ it_behaves_like "requires valid authentication" do
181
+ let(:action) { anonymous_client.state_county }
182
+ end
183
+
184
+ it_behaves_like "handles 404 response" do
185
+ let(:action) { authenticated_client.state_county }
186
+ end
187
+
188
+ it_behaves_like "handles 400 response" do
189
+ let(:action) { authenticated_client.state_county }
190
+ end
191
+
192
+ it_behaves_like "handles 400 response" do
193
+ let(:action) { authenticated_client.state_county }
194
+ end
195
+ end
196
+
197
+ context "with valid access_token" do
198
+ let(:fixture) { request_fixture('cass/state_county') }
199
+ it "should get response" do
200
+ Excon.stub({ :method => :get, :path => '/api/cass/state_county', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
201
+ params = {:state => "CO"}
202
+ response = authenticated_client.state_county(params)
203
+ expect(response.keys.count).to eq(4)
204
+ expect(response['return_code']).to eq('64')
205
+ end
206
+ end
207
+ end
47
208
  end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe FmaRealestate::PublicRecordSale do
4
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => true) }
5
+ let(:anonymous_client) { described_class.new(:raise_errors => true) }
6
+
7
+ describe "#search_by_cass_search_key" do
8
+ context "with :raise_errors => false" do
9
+ let(:authenticated_client) { described_class.new(:access_token => 'test', :raise_errors => false) }
10
+
11
+ it_behaves_like "handles error suppression" do
12
+ let(:action) { authenticated_client.search_by_cass_search_key }
13
+ end
14
+ end
15
+
16
+ context "with :raise_errors => true" do
17
+
18
+ it_behaves_like "requires valid authentication" do
19
+ let(:action) { anonymous_client.search_by_cass_search_key }
20
+ end
21
+
22
+ it_behaves_like "handles 404 response" do
23
+ let(:action) { authenticated_client.search_by_cass_search_key }
24
+ end
25
+
26
+ it_behaves_like "handles 400 response" do
27
+ let(:action) { authenticated_client.search_by_cass_search_key }
28
+ end
29
+
30
+ it_behaves_like "handles 400 response" do
31
+ let(:action) { authenticated_client.search_by_cass_search_key }
32
+ end
33
+ end
34
+
35
+ context "with valid access_token" do
36
+ let(:fixture) { request_fixture('public_record_sale/search_by_cass_search_key') }
37
+
38
+ it "should get response" do
39
+ Excon.stub({ :method => :get, :path => '/api/public_record_sales/search_by_cass_search_key', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
40
+ params = {:cass_search_key => "90803513805UNIT405"}
41
+ response = authenticated_client.search_by_cass_search_key(params)
42
+ expect(response["count"]).to be_a Integer
43
+ expect(response["results"]).to be_a Array
44
+ expect(response["results"].count).to eq(1)
45
+ expect(response["results"].first).to be_a Hash
46
+ end
47
+ end
48
+ end
49
+ end
@@ -33,7 +33,7 @@ describe FmaRealestate::PublicRecord do
33
33
  end
34
34
 
35
35
  context "with valid access_token" do
36
- let(:fixture) { request_fixture('search_by_address') }
36
+ let(:fixture) { request_fixture('public_record/search_by_address') }
37
37
 
38
38
  it "should get response" do
39
39
  Excon.stub({ :method => :get, :path => '/api/public_records/search_by_address', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
@@ -77,7 +77,7 @@ describe FmaRealestate::PublicRecord do
77
77
  end
78
78
 
79
79
  context "with valid access_token" do
80
- let(:fixture) { request_fixture('search_by_advanced') }
80
+ let(:fixture) { request_fixture('public_record/search_by_advanced') }
81
81
 
82
82
  it "should get response" do
83
83
  Excon.stub({ :method => :get, :path => '/api/public_records/search_by_advanced', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
@@ -122,7 +122,7 @@ describe FmaRealestate::PublicRecord do
122
122
  end
123
123
 
124
124
  context "with valid access_token" do
125
- let(:fixture) { request_fixture('search_by_address_advanced') }
125
+ let(:fixture) { request_fixture('public_record/search_by_address_advanced') }
126
126
 
127
127
  it "should get response" do
128
128
  Excon.stub({ :method => :get, :path => '/api/public_records/search_by_address_advanced', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
@@ -166,7 +166,7 @@ describe FmaRealestate::PublicRecord do
166
166
  end
167
167
 
168
168
  context "with valid access_token" do
169
- let(:fixture) { request_fixture('search_by_global') }
169
+ let(:fixture) { request_fixture('public_record/search_by_global') }
170
170
 
171
171
  it "should get response" do
172
172
  Excon.stub({ :method => :get, :path => '/api/public_records/search_by_global', :headers => { 'Authorization' => "Token token=test" }}, {:status => 200, :body => fixture })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fma_realestate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blaine Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -98,13 +98,20 @@ files:
98
98
  - lib/fma_realestate/client.rb
99
99
  - lib/fma_realestate/exceptions.rb
100
100
  - lib/fma_realestate/public_record.rb
101
+ - lib/fma_realestate/public_record_sale.rb
101
102
  - lib/fma_realestate/version.rb
102
- - spec/fixtures/search_by_address.json
103
- - spec/fixtures/search_by_address_advanced.json
104
- - spec/fixtures/search_by_advanced.json
105
- - spec/fixtures/search_by_global.json
106
- - spec/fixtures/tiger.json
103
+ - spec/fixtures/cass/address.json
104
+ - spec/fixtures/cass/city_county.json
105
+ - spec/fixtures/cass/city_zip.json
106
+ - spec/fixtures/cass/state_county.json
107
+ - spec/fixtures/cass/tiger.json
108
+ - spec/fixtures/public_record/search_by_address.json
109
+ - spec/fixtures/public_record/search_by_address_advanced.json
110
+ - spec/fixtures/public_record/search_by_advanced.json
111
+ - spec/fixtures/public_record/search_by_global.json
112
+ - spec/fixtures/public_record_sale/search_by_cass_search_key.json
107
113
  - spec/fma_realestate/cass_spec.rb
114
+ - spec/fma_realestate/public_record_sale_spec.rb
108
115
  - spec/fma_realestate/public_record_spec.rb
109
116
  - spec/fma_realestate_spec.rb
110
117
  - spec/spec_helper.rb
@@ -135,12 +142,18 @@ signing_key:
135
142
  specification_version: 4
136
143
  summary: FMA Real Estate and CASS Ruby Client
137
144
  test_files:
138
- - spec/fixtures/search_by_address.json
139
- - spec/fixtures/search_by_address_advanced.json
140
- - spec/fixtures/search_by_advanced.json
141
- - spec/fixtures/search_by_global.json
142
- - spec/fixtures/tiger.json
145
+ - spec/fixtures/cass/address.json
146
+ - spec/fixtures/cass/city_county.json
147
+ - spec/fixtures/cass/city_zip.json
148
+ - spec/fixtures/cass/state_county.json
149
+ - spec/fixtures/cass/tiger.json
150
+ - spec/fixtures/public_record/search_by_address.json
151
+ - spec/fixtures/public_record/search_by_address_advanced.json
152
+ - spec/fixtures/public_record/search_by_advanced.json
153
+ - spec/fixtures/public_record/search_by_global.json
154
+ - spec/fixtures/public_record_sale/search_by_cass_search_key.json
143
155
  - spec/fma_realestate/cass_spec.rb
156
+ - spec/fma_realestate/public_record_sale_spec.rb
144
157
  - spec/fma_realestate/public_record_spec.rb
145
158
  - spec/fma_realestate_spec.rb
146
159
  - spec/spec_helper.rb