mls 0.14.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +6 -6
- data/lib/mls.rb +73 -427
- data/lib/mls/account.rb +15 -0
- data/lib/mls/address.rb +4 -0
- data/lib/mls/agency.rb +6 -0
- data/lib/mls/brokerage.rb +7 -0
- data/lib/mls/coworking_space.rb +5 -0
- data/lib/mls/floorplan.rb +11 -0
- data/lib/mls/flyer.rb +11 -0
- data/lib/mls/lease.rb +2 -0
- data/lib/mls/listing.rb +135 -0
- data/lib/mls/locality.rb +6 -0
- data/lib/mls/photo.rb +18 -0
- data/lib/mls/property.rb +24 -0
- data/lib/mls/region.rb +13 -0
- data/lib/mls/sale.rb +2 -0
- data/lib/mls/space.rb +3 -0
- data/lib/mls/sublease.rb +2 -0
- data/lib/mls/use.rb +25 -0
- data/mls.gemspec +11 -15
- data/test/mls/attribute_test.rb +55 -0
- data/test/mls/resource_test.rb +31 -0
- data/test/mls_test.rb +27 -0
- data/test/test_helper.rb +26 -27
- metadata +43 -75
- data/lib/mls/attribute.rb +0 -44
- data/lib/mls/attributes/array.rb +0 -11
- data/lib/mls/attributes/boolean.rb +0 -9
- data/lib/mls/attributes/datetime.rb +0 -25
- data/lib/mls/attributes/decimal.rb +0 -21
- data/lib/mls/attributes/fixnum.rb +0 -16
- data/lib/mls/attributes/hash.rb +0 -15
- data/lib/mls/attributes/string.rb +0 -15
- data/lib/mls/errors.rb +0 -29
- data/lib/mls/factories/account.rb +0 -34
- data/lib/mls/factories/address.rb +0 -16
- data/lib/mls/factories/listing.rb +0 -29
- data/lib/mls/factories_helper.rb +0 -7
- data/lib/mls/model.rb +0 -125
- data/lib/mls/models/account.rb +0 -174
- data/lib/mls/models/address.rb +0 -58
- data/lib/mls/models/brokerage.rb +0 -31
- data/lib/mls/models/floorplan.rb +0 -45
- data/lib/mls/models/flyer.rb +0 -45
- data/lib/mls/models/listing.rb +0 -394
- data/lib/mls/models/pdf.rb +0 -15
- data/lib/mls/models/photo.rb +0 -40
- data/lib/mls/models/property.rb +0 -114
- data/lib/mls/models/region.rb +0 -56
- data/lib/mls/models/tour.rb +0 -54
- data/lib/mls/models/video.rb +0 -18
- data/lib/mls/parser.rb +0 -74
- data/lib/mls/resource.rb +0 -99
- data/lib/rdoc/generator/template/42floors/_context.rhtml +0 -209
- data/lib/rdoc/generator/template/42floors/_head.rhtml +0 -7
- data/lib/rdoc/generator/template/42floors/class.rhtml +0 -39
- data/lib/rdoc/generator/template/42floors/file.rhtml +0 -35
- data/lib/rdoc/generator/template/42floors/index.rhtml +0 -13
- data/lib/rdoc/generator/template/42floors/resources/apple-touch-icon.png +0 -0
- data/lib/rdoc/generator/template/42floors/resources/css/github.css +0 -129
- data/lib/rdoc/generator/template/42floors/resources/css/main.css +0 -339
- data/lib/rdoc/generator/template/42floors/resources/css/panel.css +0 -389
- data/lib/rdoc/generator/template/42floors/resources/css/reset.css +0 -48
- data/lib/rdoc/generator/template/42floors/resources/favicon.ico +0 -0
- data/lib/rdoc/generator/template/42floors/resources/i/arrows.png +0 -0
- data/lib/rdoc/generator/template/42floors/resources/i/results_bg.png +0 -0
- data/lib/rdoc/generator/template/42floors/resources/i/tree_bg.png +0 -0
- data/lib/rdoc/generator/template/42floors/resources/js/highlight.pack.js +0 -1
- data/lib/rdoc/generator/template/42floors/resources/js/jquery-1.3.2.min.js +0 -19
- data/lib/rdoc/generator/template/42floors/resources/js/jquery-effect.js +0 -593
- data/lib/rdoc/generator/template/42floors/resources/js/main.js +0 -20
- data/lib/rdoc/generator/template/42floors/resources/js/searchdoc.js +0 -442
- data/lib/rdoc/generator/template/42floors/resources/panel/index.html +0 -73
- data/lib/rdoc/generator/template/42floors/se_index.rhtml +0 -8
- data/test/units/properties/test_boolean.rb +0 -4
- data/test/units/test_errors.rb +0 -32
- data/test/units/test_mls.rb +0 -294
- data/test/units/test_property.rb +0 -35
@@ -1,73 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
6
|
-
<head>
|
7
|
-
<title>search index</title>
|
8
|
-
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
-
<link rel="stylesheet" href="../css/panel.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
-
<script src="../js/search_index.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="../js/searcher.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<script src="tree.js" type="text/javascript" charset="utf-8"></script>
|
13
|
-
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="../js/searchdoc.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script type="text/javascript" charset="utf-8">
|
16
|
-
function placeholder() {
|
17
|
-
if ($('<input type="text">')[0].placeholder !== undefined) return;
|
18
|
-
|
19
|
-
$('#search-label').click(function() {
|
20
|
-
$('#search').focus();
|
21
|
-
$('#search-label').hide();
|
22
|
-
});
|
23
|
-
|
24
|
-
$('#search').focus(function() {
|
25
|
-
$('#search-label').hide();
|
26
|
-
});
|
27
|
-
$('#search').blur(function() {
|
28
|
-
this.value == '' && $('#search-label').show()
|
29
|
-
});
|
30
|
-
|
31
|
-
$('#search')[0].value == '' && $('#search-label').show();
|
32
|
-
}
|
33
|
-
$(function() {
|
34
|
-
placeholder();
|
35
|
-
$('#links').hide();
|
36
|
-
var panel = new Searchdoc.Panel($('#panel'), search_data, tree, top.frames[1]);
|
37
|
-
$('#search').focus();
|
38
|
-
|
39
|
-
var s = window.parent.location.search.match(/\?q=([^&]+)/);
|
40
|
-
if (s) {
|
41
|
-
s = decodeURIComponent(s[1]).replace(/\+/g, ' ');
|
42
|
-
if (s.length > 0)
|
43
|
-
{
|
44
|
-
$('#search').val(s);
|
45
|
-
panel.search(s, true);
|
46
|
-
}
|
47
|
-
}
|
48
|
-
})
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
<body>
|
52
|
-
<div class="panel panel_tree" id="panel">
|
53
|
-
<div class="header">
|
54
|
-
<div>
|
55
|
-
<label for="search" id="search-label" style="display: none">Search</label>
|
56
|
-
<table>
|
57
|
-
<tr><td>
|
58
|
-
<input type="Search" placeholder="Search" autosave="searchdoc" results="10" id="search" autocomplete="off"/>
|
59
|
-
</td></tr>
|
60
|
-
</table></div>
|
61
|
-
</div>
|
62
|
-
<div class="tree">
|
63
|
-
<ul>
|
64
|
-
</ul>
|
65
|
-
</div>
|
66
|
-
<div class="result">
|
67
|
-
<ul>
|
68
|
-
</ul>
|
69
|
-
</div>
|
70
|
-
</div>
|
71
|
-
<a href="links.html" id="links">index</a>
|
72
|
-
</body>
|
73
|
-
</html>
|
data/test/units/test_errors.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TestErrors < ::Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_exception
|
6
|
-
assert defined?(MLS::Exception)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_bad_request
|
10
|
-
assert defined?(MLS::Exception::BadRequest)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_unauthorized
|
14
|
-
assert defined?(MLS::Exception::Unauthorized)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_not_found
|
18
|
-
assert defined?(MLS::Exception::NotFound)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_api_version_unsupported
|
22
|
-
assert defined?(MLS::Exception::ApiVersionUnsupported)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_record_invalide
|
26
|
-
assert defined?(MLS::Exception::RecordInvalid)
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_service_unavailable
|
30
|
-
assert defined?(MLS::Exception::ServiceUnavailable)
|
31
|
-
end
|
32
|
-
end
|
data/test/units/test_mls.rb
DELETED
@@ -1,294 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TestMLS < ::Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_API_VERSION
|
6
|
-
assert_equal "0.1.0", MLS::API_VERSION
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_attr_accessors
|
10
|
-
mls = MLS.instance
|
11
|
-
|
12
|
-
assert mls.respond_to?(:url)
|
13
|
-
assert mls.respond_to?(:url=)
|
14
|
-
assert mls.respond_to?(:api_key)
|
15
|
-
assert mls.respond_to?(:auth_cookie)
|
16
|
-
assert mls.respond_to?(:logger)
|
17
|
-
assert mls.respond_to?(:connection)
|
18
|
-
assert mls.respond_to?(:prepare_request)
|
19
|
-
|
20
|
-
assert mls.respond_to?(:put)
|
21
|
-
assert mls.respond_to?(:post)
|
22
|
-
assert mls.respond_to?(:get)
|
23
|
-
assert mls.respond_to?(:delete)
|
24
|
-
|
25
|
-
assert mls.respond_to?(:handle_response)
|
26
|
-
assert mls.respond_to?(:ping)
|
27
|
-
assert mls.respond_to?(:auth_ping)
|
28
|
-
assert mls.respond_to?(:default_logger)
|
29
|
-
end
|
30
|
-
|
31
|
-
# MLS.get =================================================================
|
32
|
-
|
33
|
-
test '#get' do
|
34
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get')
|
35
|
-
response = MLS.get('/test')
|
36
|
-
assert_equal 'get', response.body
|
37
|
-
end
|
38
|
-
|
39
|
-
test '#get with params' do
|
40
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test?key=value", :body => 'get')
|
41
|
-
response = MLS.get('/test', :key => 'value')
|
42
|
-
|
43
|
-
assert_equal '/test?key=value', FakeWeb.last_request.path
|
44
|
-
end
|
45
|
-
|
46
|
-
test '#get to 404 raises MLS::Exception::NotFound' do
|
47
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
48
|
-
|
49
|
-
assert_raises(MLS::Exception::NotFound) { MLS.get('/test') }
|
50
|
-
end
|
51
|
-
|
52
|
-
test '#get to 404 doesnt raise NotFound if in valid_response_codes' do
|
53
|
-
assert_nothing_raised {
|
54
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
55
|
-
MLS.get('/test', nil, 404)
|
56
|
-
|
57
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
58
|
-
MLS.get('/test', nil, 400..499)
|
59
|
-
|
60
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
61
|
-
MLS.get('/test', nil, 300..399, 404)
|
62
|
-
|
63
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
64
|
-
MLS.get('/test', nil, 404, 300..399)
|
65
|
-
|
66
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['404', ''])
|
67
|
-
MLS.get('/test', nil, [300..399, 404])
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
test '#get with block' do
|
72
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get')
|
73
|
-
MLS.get('/test') do |response|
|
74
|
-
assert_equal 'get', response.body
|
75
|
-
end
|
76
|
-
|
77
|
-
# make sure block is not called when not in valid_response_codes
|
78
|
-
FakeWeb.register_uri(:get, "#{MLS_HOST}/test", :body => 'get', :status => ['401', ''])
|
79
|
-
assert_raises(MLS::Exception::Unauthorized) {
|
80
|
-
MLS.get('/test') do |response|
|
81
|
-
raise MLS::Exception, 'Should not get here'
|
82
|
-
end
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
# MLS.put =================================================================
|
87
|
-
|
88
|
-
test '#put' do
|
89
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put')
|
90
|
-
response = MLS.put('/test')
|
91
|
-
assert_equal 'put', response.body
|
92
|
-
end
|
93
|
-
|
94
|
-
test '#put with a body' do
|
95
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put')
|
96
|
-
response = MLS.put('/test', :key => 'value')
|
97
|
-
|
98
|
-
assert_equal '{"key":"value"}', FakeWeb.last_request.body
|
99
|
-
end
|
100
|
-
|
101
|
-
test '#put to 404 raises MLS::Exception::NotFound' do
|
102
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
103
|
-
|
104
|
-
assert_raises(MLS::Exception::NotFound) { MLS.put('/test') }
|
105
|
-
end
|
106
|
-
|
107
|
-
test '#put to 404 doesnt raise NotFound if in valid_response_codes' do
|
108
|
-
assert_nothing_raised {
|
109
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
110
|
-
MLS.put('/test', nil, 404)
|
111
|
-
|
112
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
113
|
-
MLS.put('/test', nil, 400..499)
|
114
|
-
|
115
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
116
|
-
MLS.put('/test', nil, 300..399, 404)
|
117
|
-
|
118
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
119
|
-
MLS.put('/test', nil, 404, 300..399)
|
120
|
-
|
121
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['404', ''])
|
122
|
-
MLS.put('/test', nil, [300..399, 404])
|
123
|
-
}
|
124
|
-
end
|
125
|
-
|
126
|
-
test '#put with block' do
|
127
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put')
|
128
|
-
MLS.put('/test') do |response|
|
129
|
-
assert_equal 'put', response.body
|
130
|
-
end
|
131
|
-
|
132
|
-
# make sure block is not called when not in valid_response_codes
|
133
|
-
FakeWeb.register_uri(:put, "#{MLS_HOST}/test", :body => 'put', :status => ['401', ''])
|
134
|
-
assert_raises(MLS::Exception::Unauthorized) {
|
135
|
-
MLS.put('/test') do |response|
|
136
|
-
raise MLS::Exception, 'Should not get here'
|
137
|
-
end
|
138
|
-
}
|
139
|
-
end
|
140
|
-
|
141
|
-
# MLS.post =================================================================
|
142
|
-
|
143
|
-
test '#post' do
|
144
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post')
|
145
|
-
response = MLS.post('/test')
|
146
|
-
assert_equal 'post', response.body
|
147
|
-
end
|
148
|
-
|
149
|
-
test '#post with a body' do
|
150
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post')
|
151
|
-
response = MLS.post('/test', :key => 'value')
|
152
|
-
|
153
|
-
assert_equal '{"key":"value"}', FakeWeb.last_request.body
|
154
|
-
end
|
155
|
-
|
156
|
-
test '#post to 404 raises MLS::Exception::NotFound' do
|
157
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
158
|
-
|
159
|
-
assert_raises(MLS::Exception::NotFound) { MLS.post('/test') }
|
160
|
-
end
|
161
|
-
|
162
|
-
test '#post to 404 doesnt raise NotFound if in valid_response_codes' do
|
163
|
-
assert_nothing_raised {
|
164
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
165
|
-
MLS.post('/test', nil, 404)
|
166
|
-
|
167
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
168
|
-
MLS.post('/test', nil, 400..499)
|
169
|
-
|
170
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
171
|
-
MLS.post('/test', nil, 300..399, 404)
|
172
|
-
|
173
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
174
|
-
MLS.post('/test', nil, 404, 300..399)
|
175
|
-
|
176
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['404', ''])
|
177
|
-
MLS.post('/test', nil, [300..399, 404])
|
178
|
-
}
|
179
|
-
end
|
180
|
-
|
181
|
-
test '#post with block' do
|
182
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post')
|
183
|
-
MLS.post('/test') do |response|
|
184
|
-
assert_equal 'post', response.body
|
185
|
-
end
|
186
|
-
|
187
|
-
# make sure block is not called when not in valid_response_codes
|
188
|
-
FakeWeb.register_uri(:post, "#{MLS_HOST}/test", :body => 'post', :status => ['401', ''])
|
189
|
-
assert_raises(MLS::Exception::Unauthorized) {
|
190
|
-
MLS.post('/test') do |response|
|
191
|
-
raise MLS::Exception, 'Should not get here'
|
192
|
-
end
|
193
|
-
}
|
194
|
-
end
|
195
|
-
|
196
|
-
# MLS.delete ================================================================
|
197
|
-
|
198
|
-
test '#delete' do
|
199
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete')
|
200
|
-
response = MLS.delete('/test')
|
201
|
-
assert_equal 'delete', response.body
|
202
|
-
end
|
203
|
-
|
204
|
-
test '#delete with a body' do
|
205
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete')
|
206
|
-
response = MLS.delete('/test', :key => 'value')
|
207
|
-
|
208
|
-
assert_equal '{"key":"value"}', FakeWeb.last_request.body
|
209
|
-
end
|
210
|
-
|
211
|
-
test '#delete to 404 raises MLS::Exception::NotFound' do
|
212
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
213
|
-
|
214
|
-
assert_raises(MLS::Exception::NotFound) { MLS.delete('/test') }
|
215
|
-
end
|
216
|
-
|
217
|
-
test '#delete to 404 doesnt raise NotFound if in valid_response_codes' do
|
218
|
-
assert_nothing_raised {
|
219
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
220
|
-
MLS.delete('/test', nil, 404)
|
221
|
-
|
222
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
223
|
-
MLS.delete('/test', nil, 400..499)
|
224
|
-
|
225
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
226
|
-
MLS.delete('/test', nil, 300..399, 404)
|
227
|
-
|
228
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
229
|
-
MLS.delete('/test', nil, 404, 300..399)
|
230
|
-
|
231
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['404', ''])
|
232
|
-
MLS.delete('/test', nil, [300..399, 404])
|
233
|
-
}
|
234
|
-
end
|
235
|
-
|
236
|
-
test '#delete with block' do
|
237
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete')
|
238
|
-
MLS.delete('/test') do |response|
|
239
|
-
assert_equal 'delete', response.body
|
240
|
-
end
|
241
|
-
|
242
|
-
# make sure block is not called when not in valid_response_codes
|
243
|
-
FakeWeb.register_uri(:delete, "#{MLS_HOST}/test", :body => 'delete', :status => ['401', ''])
|
244
|
-
assert_raises(MLS::Exception::Unauthorized) {
|
245
|
-
MLS.delete('/test') do |response|
|
246
|
-
raise MLS::Exception, 'Should not get here'
|
247
|
-
end
|
248
|
-
}
|
249
|
-
end
|
250
|
-
|
251
|
-
# MLS.handle_response ======================================================
|
252
|
-
|
253
|
-
test 'handle_response raises BadRequest on 400' do
|
254
|
-
response = mock_response(:get, 400)
|
255
|
-
assert_raises(MLS::Exception::BadRequest) { MLS.handle_response(response) }
|
256
|
-
end
|
257
|
-
|
258
|
-
test 'handle_response raises Unauthorized on 401' do
|
259
|
-
response = mock_response(:get, 401)
|
260
|
-
assert_raises(MLS::Exception::Unauthorized) { MLS.handle_response(response) }
|
261
|
-
end
|
262
|
-
|
263
|
-
test 'handle_response raises NotFound on 404' do
|
264
|
-
response = mock_response(:get, 404)
|
265
|
-
assert_raises(MLS::Exception::NotFound) { MLS.handle_response(response) }
|
266
|
-
end
|
267
|
-
|
268
|
-
test 'handle_response raises NotFound on 410' do
|
269
|
-
response = mock_response(:get, 410)
|
270
|
-
assert_raises(MLS::Exception::NotFound) { MLS.handle_response(response) }
|
271
|
-
end
|
272
|
-
|
273
|
-
test 'handle_response raises ApiVersionUnsupported on 422' do
|
274
|
-
response = mock_response(:get, 422)
|
275
|
-
assert_raises(MLS::Exception::ApiVersionUnsupported) { MLS.handle_response(response) }
|
276
|
-
end
|
277
|
-
|
278
|
-
test 'handle_response raises ServiceUnavailable on 503' do
|
279
|
-
response = mock_response(:get, 503)
|
280
|
-
assert_raises(MLS::Exception::ServiceUnavailable) { MLS.handle_response(response) }
|
281
|
-
end
|
282
|
-
|
283
|
-
test 'handle_response raises Exception on 350, 450, & 550' do
|
284
|
-
response = mock_response(:get, 350)
|
285
|
-
assert_raises(MLS::Exception) { MLS.handle_response(response) }
|
286
|
-
|
287
|
-
response = mock_response(:get, 450)
|
288
|
-
assert_raises(MLS::Exception) { MLS.handle_response(response) }
|
289
|
-
|
290
|
-
response = mock_response(:get, 550)
|
291
|
-
assert_raises(MLS::Exception) { MLS.handle_response(response) }
|
292
|
-
end
|
293
|
-
|
294
|
-
end
|
data/test/units/test_property.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class TestAttribute < ::Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_DEFAULT_OPTIONS
|
6
|
-
assert_equal :always, MLS::Attribute::DEFAULT_OPTIONS[:serialize]
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_attr_readers
|
10
|
-
attribute = MLS::Attribute.new(:name => "blah")
|
11
|
-
|
12
|
-
assert attribute.respond_to?(:model)
|
13
|
-
assert attribute.respond_to?(:name)
|
14
|
-
assert attribute.respond_to?(:instance_variable_name)
|
15
|
-
assert attribute.respond_to?(:options)
|
16
|
-
assert attribute.respond_to?(:default)
|
17
|
-
assert attribute.respond_to?(:reader_visibility)
|
18
|
-
assert attribute.respond_to?(:writer_visibility)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_instance_methods
|
22
|
-
attribute = MLS::Attribute.new(:name => "blah")
|
23
|
-
|
24
|
-
assert attribute.respond_to?(:set_default_value)
|
25
|
-
assert attribute.respond_to?(:determine_visibility)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_class_methods
|
29
|
-
assert MLS::Attribute.respond_to?(:determine_class)
|
30
|
-
assert MLS::Attribute.respond_to?(:inherited)
|
31
|
-
assert MLS::Attribute.respond_to?(:demodulized_names)
|
32
|
-
assert MLS::Attribute.respond_to?(:find_class)
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|