mls 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +12 -0
- data/lib/mls.rb +11 -19
- data/lib/mls/models/account.rb +15 -16
- data/lib/mls/models/tour_request.rb +47 -0
- data/lib/mls/version.rb +1 -1
- data/mls.gemspec +4 -1
- data/test/test_helper.rb +7 -0
- data/test/units/models/test_account.rb +51 -0
- data/test/units/models/test_address.rb +29 -0
- data/test/units/models/test_listing.rb +74 -0
- data/test/units/models/test_photo.rb +11 -0
- data/test/units/models/test_tour_request.rb +26 -0
- data/test/units/properties/test_boolean.rb +4 -0
- data/test/units/test_errors.rb +24 -0
- data/test/units/test_mls.rb +34 -0
- data/test/units/test_model.rb +24 -0
- data/test/units/test_parser.rb +32 -0
- data/test/units/test_property.rb +35 -0
- data/test/units/test_resource.rb +29 -0
- metadata +55 -17
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rake/testtask'
|
2
3
|
|
3
4
|
task :console do
|
4
5
|
exec 'irb -I lib -r mls.rb'
|
5
6
|
end
|
6
7
|
task :c => :console
|
8
|
+
|
9
|
+
|
10
|
+
Rake::TestTask.new do |t|
|
11
|
+
t.libs << 'lib' << 'test'
|
12
|
+
t.test_files = FileList['test/units/**/test*.rb']
|
13
|
+
t.warning = true
|
14
|
+
t.verbose = true
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run tests"
|
18
|
+
task :default => :test
|
data/lib/mls.rb
CHANGED
@@ -29,7 +29,7 @@ class MLS
|
|
29
29
|
|
30
30
|
API_VERSION = '0.1.0'
|
31
31
|
|
32
|
-
attr_accessor :url, :api_key, :auth_key, :logger
|
32
|
+
attr_accessor :url, :api_key, :auth_key, :logger, :asset_host
|
33
33
|
|
34
34
|
def url=(uri)
|
35
35
|
@url = uri
|
@@ -48,6 +48,10 @@ class MLS
|
|
48
48
|
@connection ||= Net::HTTP.new(@host, @port)
|
49
49
|
end
|
50
50
|
|
51
|
+
def asset_host
|
52
|
+
@asset_host ||= get('/asset_host').body
|
53
|
+
end
|
54
|
+
|
51
55
|
def add_headers(req)
|
52
56
|
req['Content-Type'] = 'application/json'
|
53
57
|
req['X-42Floors-API-Version'] = API_VERSION
|
@@ -160,34 +164,22 @@ class MLS
|
|
160
164
|
|
161
165
|
end
|
162
166
|
|
163
|
-
#require File.expand_path('../mls/errors', __FILE__)
|
164
|
-
#require File.expand_path('../mls/resource', __FILE__)
|
165
|
-
#require File.expand_path('../mls/model', __FILE__)
|
166
|
-
#require File.expand_path('../mls/property', __FILE__)
|
167
|
-
#require File.expand_path('../mls/parser', __FILE__)
|
168
|
-
|
169
167
|
require 'mls/errors'
|
170
168
|
require 'mls/resource'
|
171
|
-
require 'mls/model'
|
172
|
-
require 'mls/property'
|
173
169
|
require 'mls/parser'
|
174
170
|
|
175
|
-
#
|
176
|
-
|
177
|
-
#require File.expand_path('../mls/properties/decimal', __FILE__)
|
178
|
-
#require File.expand_path('../mls/properties/datetime', __FILE__)
|
179
|
-
#require File.expand_path('../mls/properties/string', __FILE__)
|
180
|
-
|
171
|
+
# Properties
|
172
|
+
require 'mls/property'
|
181
173
|
require 'mls/properties/fixnum'
|
182
174
|
require 'mls/properties/boolean'
|
183
175
|
require 'mls/properties/decimal'
|
184
176
|
require 'mls/properties/datetime'
|
185
177
|
require 'mls/properties/string'
|
186
178
|
|
187
|
-
#
|
188
|
-
|
189
|
-
#require File.expand_path('../mls/models/address', __FILE__)
|
190
|
-
|
179
|
+
# Models
|
180
|
+
require 'mls/model'
|
191
181
|
require 'mls/models/account'
|
192
182
|
require 'mls/models/listing'
|
193
183
|
require 'mls/models/address'
|
184
|
+
require 'mls/models/photo'
|
185
|
+
require 'mls/models/tour_request'
|
data/lib/mls/models/account.rb
CHANGED
@@ -6,6 +6,7 @@ class MLS::Account < MLS::Resource
|
|
6
6
|
property :id, Fixnum
|
7
7
|
property :role, String, :default => 'user'
|
8
8
|
property :name, String
|
9
|
+
property :title, String
|
9
10
|
property :email, String
|
10
11
|
property :password, String, :serialize => :if_present
|
11
12
|
property :password_confirmation, String, :serialize => :if_present
|
@@ -19,11 +20,20 @@ class MLS::Account < MLS::Resource
|
|
19
20
|
property :twitter, String
|
20
21
|
property :facebook, String
|
21
22
|
property :web, String
|
23
|
+
property :mls_number, String
|
22
24
|
|
25
|
+
property :city, String
|
23
26
|
property :state, String
|
24
|
-
property :
|
27
|
+
property :country, String
|
25
28
|
|
26
29
|
property :auth_key, String
|
30
|
+
|
31
|
+
property :funding, String
|
32
|
+
property :message, String
|
33
|
+
property :population, String
|
34
|
+
property :growing, Boolean
|
35
|
+
property :move_in, String
|
36
|
+
property :extra_info, String
|
27
37
|
|
28
38
|
def update!
|
29
39
|
MLS.put('/account', to_hash) do |code, response|
|
@@ -56,19 +66,9 @@ class MLS::Account < MLS::Resource
|
|
56
66
|
role != 'user' && role != ''
|
57
67
|
end
|
58
68
|
|
59
|
-
def favorites
|
60
|
-
|
61
|
-
|
62
|
-
MLS.get('/account/favorites', params_hash) do |code, response|
|
63
|
-
case code
|
64
|
-
when 400
|
65
|
-
@errors = MLS.parse(response.body)[:errors]
|
66
|
-
return false
|
67
|
-
else
|
68
|
-
MLS.handle_response(response)
|
69
|
-
return MLS::Listing::Parser.parse_collection(response.body)
|
70
|
-
end
|
71
|
-
end
|
69
|
+
def favorites
|
70
|
+
response = MLS.get('/account/favorites')
|
71
|
+
MLS::Listing::Parser.parse_collection(response.body)
|
72
72
|
end
|
73
73
|
|
74
74
|
def favorite(listing_id)
|
@@ -98,7 +98,7 @@ class MLS::Account < MLS::Resource
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
class << self
|
103
103
|
|
104
104
|
def current
|
@@ -140,7 +140,6 @@ class MLS::Account < MLS::Resource
|
|
140
140
|
return false
|
141
141
|
end
|
142
142
|
|
143
|
-
|
144
143
|
end
|
145
144
|
|
146
145
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class MLS::TourRequest < MLS::Resource
|
2
|
+
property :message, String
|
3
|
+
|
4
|
+
attr_accessor :listing
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def get_all_for_account
|
8
|
+
MLS.get('/account/tour_requests') do |code, response|
|
9
|
+
case code
|
10
|
+
when 400
|
11
|
+
@errors = MLS.parse(response.body)[:errors]
|
12
|
+
return false
|
13
|
+
else
|
14
|
+
MLS.handle_response(response)
|
15
|
+
return MLS::TourRequest::Parser.parse_collection(response.body)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create(listing_id, message, account_params={})
|
21
|
+
params = account_params
|
22
|
+
params[:id] = listing_id
|
23
|
+
params[:message] = message
|
24
|
+
MLS.post('/account/tour_requests', params) do |code, response|
|
25
|
+
case code
|
26
|
+
when 400
|
27
|
+
@errors = MLS.parse(response.body)[:errors]
|
28
|
+
return false
|
29
|
+
else
|
30
|
+
MLS.handle_response(response)
|
31
|
+
return true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class MLS::TourRequest::Parser < MLS::Parser
|
39
|
+
|
40
|
+
def listing=(listing)
|
41
|
+
@object.listing = MLS::Listing::Parser.build(listing)
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.collection_root_element
|
45
|
+
:tour_requests
|
46
|
+
end
|
47
|
+
end
|
data/lib/mls/version.rb
CHANGED
data/mls.gemspec
CHANGED
@@ -18,12 +18,15 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
#
|
21
|
+
# Developoment
|
22
22
|
s.add_development_dependency 'rake'
|
23
23
|
s.add_development_dependency 'rdoc'
|
24
24
|
s.add_development_dependency 'bundler'
|
25
25
|
s.add_development_dependency 'minitest'
|
26
26
|
s.add_development_dependency 'turn'
|
27
|
+
|
28
|
+
# Runtime
|
27
29
|
s.add_runtime_dependency 'activeresource'
|
28
30
|
s.add_runtime_dependency 'yajl-ruby'
|
31
|
+
s.add_runtime_dependency 'simplecov'
|
29
32
|
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestAccount < ::Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_properties
|
6
|
+
account = MLS::Account.new
|
7
|
+
|
8
|
+
assert account.respond_to?(:id)
|
9
|
+
assert account.respond_to?(:role)
|
10
|
+
assert account.respond_to?(:name)
|
11
|
+
assert account.respond_to?(:email)
|
12
|
+
assert account.respond_to?(:password)
|
13
|
+
assert account.respond_to?(:password_confirmation)
|
14
|
+
assert account.respond_to?(:perishable_token)
|
15
|
+
assert account.respond_to?(:perishable_token_set_at)
|
16
|
+
assert account.respond_to?(:phone)
|
17
|
+
assert account.respond_to?(:company)
|
18
|
+
assert account.respond_to?(:license)
|
19
|
+
assert account.respond_to?(:linkedin)
|
20
|
+
assert account.respond_to?(:twitter)
|
21
|
+
assert account.respond_to?(:facebook)
|
22
|
+
assert account.respond_to?(:web)
|
23
|
+
assert account.respond_to?(:mls_number)
|
24
|
+
assert account.respond_to?(:state)
|
25
|
+
assert account.respond_to?(:country)
|
26
|
+
assert account.respond_to?(:auth_key)
|
27
|
+
assert account.respond_to?(:funding)
|
28
|
+
assert account.respond_to?(:message)
|
29
|
+
assert account.respond_to?(:population)
|
30
|
+
assert account.respond_to?(:growing)
|
31
|
+
assert account.respond_to?(:move_in)
|
32
|
+
assert account.respond_to?(:extra_info)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_methods
|
36
|
+
account = MLS::Account.new
|
37
|
+
|
38
|
+
assert account.respond_to?(:update!)
|
39
|
+
assert account.respond_to?(:create!)
|
40
|
+
assert account.respond_to?(:agent?)
|
41
|
+
assert account.respond_to?(:favorites)
|
42
|
+
assert account.respond_to?(:favorite)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_class_methods
|
46
|
+
assert MLS::Account.respond_to?(:current)
|
47
|
+
assert MLS::Account.respond_to?(:authenticate)
|
48
|
+
assert MLS::Account.respond_to?(:reset_password!)
|
49
|
+
assert MLS::Account.respond_to?(:update_password!)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestAddress < ::Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_properties
|
6
|
+
address = MLS::Address.new
|
7
|
+
|
8
|
+
assert address.respond_to?(:id)
|
9
|
+
assert address.respond_to?(:name)
|
10
|
+
assert address.respond_to?(:slug)
|
11
|
+
assert address.respond_to?(:latitude)
|
12
|
+
assert address.respond_to?(:longitude)
|
13
|
+
assert address.respond_to?(:formatted_address)
|
14
|
+
assert address.respond_to?(:street_number)
|
15
|
+
assert address.respond_to?(:street)
|
16
|
+
assert address.respond_to?(:neighborhood)
|
17
|
+
assert address.respond_to?(:city)
|
18
|
+
assert address.respond_to?(:county)
|
19
|
+
assert address.respond_to?(:state)
|
20
|
+
assert address.respond_to?(:country)
|
21
|
+
assert address.respond_to?(:postal_code)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_class_methods
|
25
|
+
assert MLS::Address.respond_to?(:query)
|
26
|
+
assert MLS::Address.respond_to?(:box_cluster)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestListing < ::Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_properties
|
6
|
+
listing = MLS::Listing.new
|
7
|
+
|
8
|
+
assert listing.respond_to?(:id)
|
9
|
+
assert listing.respond_to?(:address_id)
|
10
|
+
assert listing.respond_to?(:use_id)
|
11
|
+
assert listing.respond_to?(:use)
|
12
|
+
assert listing.respond_to?(:account_id)
|
13
|
+
assert listing.respond_to?(:hidden)
|
14
|
+
assert listing.respond_to?(:name)
|
15
|
+
assert listing.respond_to?(:kind)
|
16
|
+
assert listing.respond_to?(:space_type)
|
17
|
+
assert listing.respond_to?(:unit)
|
18
|
+
assert listing.respond_to?(:floor)
|
19
|
+
assert listing.respond_to?(:comments)
|
20
|
+
assert listing.respond_to?(:total_size)
|
21
|
+
assert listing.respond_to?(:maximum_contiguous_size)
|
22
|
+
assert listing.respond_to?(:minimum_divisable_size)
|
23
|
+
assert listing.respond_to?(:lease_type)
|
24
|
+
assert listing.respond_to?(:rate)
|
25
|
+
assert listing.respond_to?(:rate_units)
|
26
|
+
assert listing.respond_to?(:rate_per_month)
|
27
|
+
assert listing.respond_to?(:rate_per_year)
|
28
|
+
assert listing.respond_to?(:tenant_improvements)
|
29
|
+
assert listing.respond_to?(:nnn_expenses)
|
30
|
+
assert listing.respond_to?(:sublease_expiration)
|
31
|
+
assert listing.respond_to?(:available_on)
|
32
|
+
assert listing.respond_to?(:maximum_term_length)
|
33
|
+
assert listing.respond_to?(:minimum_term_length)
|
34
|
+
assert listing.respond_to?(:offices)
|
35
|
+
assert listing.respond_to?(:conference_rooms)
|
36
|
+
assert listing.respond_to?(:bathrooms)
|
37
|
+
assert listing.respond_to?(:desks)
|
38
|
+
assert listing.respond_to?(:kitchen)
|
39
|
+
assert listing.respond_to?(:showers)
|
40
|
+
assert listing.respond_to?(:bike_rack)
|
41
|
+
assert listing.respond_to?(:bikes_allowed)
|
42
|
+
assert listing.respond_to?(:server_room)
|
43
|
+
assert listing.respond_to?(:reception_area)
|
44
|
+
assert listing.respond_to?(:turnkey)
|
45
|
+
assert listing.respond_to?(:patio)
|
46
|
+
assert listing.respond_to?(:copy_room)
|
47
|
+
assert listing.respond_to?(:dog_friendly)
|
48
|
+
assert listing.respond_to?(:cabling)
|
49
|
+
assert listing.respond_to?(:ready_to_move_in)
|
50
|
+
assert listing.respond_to?(:recent_space_improvements)
|
51
|
+
assert listing.respond_to?(:printers)
|
52
|
+
assert listing.respond_to?(:furniture_available)
|
53
|
+
assert listing.respond_to?(:created_at)
|
54
|
+
assert listing.respond_to?(:updated_at)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_attr_accessors
|
58
|
+
listing = MLS::Listing.new
|
59
|
+
|
60
|
+
assert listing.respond_to?(:address)
|
61
|
+
assert listing.respond_to?(:agents)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_instance_methods
|
65
|
+
listing = MLS::Listing.new
|
66
|
+
|
67
|
+
assert listing.respond_to?(:photos)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_class_methods
|
71
|
+
assert MLS::Listing.respond_to?(:find)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestTourRequest < ::Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_properties
|
6
|
+
tr = MLS::TourRequest.new
|
7
|
+
|
8
|
+
assert tr.respond_to?(:message)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_attr_accessors
|
12
|
+
tr = MLS::TourRequest.new
|
13
|
+
|
14
|
+
assert tr.respond_to?(:listing)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_class_methods
|
18
|
+
assert MLS::TourRequest.respond_to?(:get_all_for_account)
|
19
|
+
assert MLS::TourRequest.respond_to?(:create)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_parser
|
23
|
+
assert defined?(MLS::TourRequest::Parser)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
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::BadRequest)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_unauthorized
|
14
|
+
assert defined?(MLS::Unauthorized)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_not_found
|
18
|
+
assert defined?(MLS::NotFound)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_api_version_unsupported
|
22
|
+
assert defined?(MLS::ApiVersionUnsupported)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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_key)
|
16
|
+
assert mls.respond_to?(:logger)
|
17
|
+
assert mls.respond_to?(:connection)
|
18
|
+
assert mls.respond_to?(:add_headers)
|
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
|
+
def test_class_methods
|
32
|
+
assert MLS.respond_to?(:parse)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MyModel
|
4
|
+
include MLS::Model
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
class TestModel < ::Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_instance_methods
|
11
|
+
model = MyModel.new
|
12
|
+
|
13
|
+
assert model.respond_to?(:property)
|
14
|
+
assert model.respond_to?(:properties)
|
15
|
+
assert model.respond_to?(:property_module)
|
16
|
+
assert model.respond_to?(:create_reader_for)
|
17
|
+
assert model.respond_to?(:create_writer_for)
|
18
|
+
assert model.respond_to?(:model_name)
|
19
|
+
assert model.respond_to?(:param_key)
|
20
|
+
assert model.respond_to?(:root_element)
|
21
|
+
assert model.respond_to?(:collection_root_element)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MyParser < MLS::Parser; end
|
4
|
+
|
5
|
+
class TestParser < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_attr_readers
|
8
|
+
parser = MyParser.new
|
9
|
+
|
10
|
+
assert parser.respond_to?(:object)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_instance_methods
|
14
|
+
parser = MyParser.new
|
15
|
+
|
16
|
+
assert parser.respond_to?(:parse)
|
17
|
+
assert parser.respond_to?(:update_attributes)
|
18
|
+
assert parser.respond_to?(:extract_attributes)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_class_methods
|
22
|
+
assert MyParser.respond_to?(:parse)
|
23
|
+
assert MyParser.respond_to?(:parse_collection)
|
24
|
+
assert MyParser.respond_to?(:build)
|
25
|
+
assert MyParser.respond_to?(:update)
|
26
|
+
assert MyParser.respond_to?(:extract_attributes)
|
27
|
+
assert MyParser.respond_to?(:object_class)
|
28
|
+
assert MyParser.respond_to?(:root_element)
|
29
|
+
assert MyParser.respond_to?(:collection_root_element)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestProperty < ::Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_DEFAULT_OPTIONS
|
6
|
+
assert_equal :always, MLS::Property::DEFAULT_OPTIONS[:serialize]
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_attr_readers
|
10
|
+
property = MLS::Property.new(:name => "blah")
|
11
|
+
|
12
|
+
assert property.respond_to?(:model)
|
13
|
+
assert property.respond_to?(:name)
|
14
|
+
assert property.respond_to?(:instance_variable_name)
|
15
|
+
assert property.respond_to?(:options)
|
16
|
+
assert property.respond_to?(:default)
|
17
|
+
assert property.respond_to?(:reader_visibility)
|
18
|
+
assert property.respond_to?(:writer_visibility)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_instance_methods
|
22
|
+
property = MLS::Property.new(:name => "blah")
|
23
|
+
|
24
|
+
assert property.respond_to?(:set_default_value)
|
25
|
+
assert property.respond_to?(:determine_visibility)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_class_methods
|
29
|
+
assert MLS::Property.respond_to?(:determine_class)
|
30
|
+
assert MLS::Property.respond_to?(:inherited)
|
31
|
+
assert MLS::Property.respond_to?(:demodulized_names)
|
32
|
+
assert MLS::Property.respond_to?(:find_class)
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MyResource < MLS::Resource; end
|
4
|
+
|
5
|
+
class TestResource < ::Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_attr_readers
|
8
|
+
resource = MyResource.new
|
9
|
+
|
10
|
+
assert resource.respond_to?(:errors)
|
11
|
+
assert resource.respond_to?(:persisted)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_instance_methods
|
15
|
+
resource = MyResource.new
|
16
|
+
|
17
|
+
assert resource.respond_to?(:new_record?)
|
18
|
+
assert resource.respond_to?(:persisted?)
|
19
|
+
assert resource.respond_to?(:save)
|
20
|
+
|
21
|
+
assert resource.respond_to?(:properties)
|
22
|
+
assert resource.respond_to?(:set_default_values)
|
23
|
+
assert resource.respond_to?(:update_attributes)
|
24
|
+
|
25
|
+
assert resource.respond_to?(:to_hash)
|
26
|
+
assert resource.respond_to?(:to_key)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70354219663760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70354219663760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &70354219663300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70354219663300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70354219662840 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70354219662840
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: minitest
|
49
|
-
requirement: &
|
49
|
+
requirement: &70354219662380 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70354219662380
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: turn
|
60
|
-
requirement: &
|
60
|
+
requirement: &70354219661960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70354219661960
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activeresource
|
71
|
-
requirement: &
|
71
|
+
requirement: &70354219661540 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70354219661540
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: yajl-ruby
|
82
|
-
requirement: &
|
82
|
+
requirement: &70354219661100 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,18 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70354219661100
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: simplecov
|
93
|
+
requirement: &70354219660680 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70354219660680
|
91
102
|
description: Ruby library for integrating with the 42Floors MLS
|
92
103
|
email:
|
93
104
|
- james@42floors.com
|
@@ -106,6 +117,7 @@ files:
|
|
106
117
|
- lib/mls/models/address.rb
|
107
118
|
- lib/mls/models/listing.rb
|
108
119
|
- lib/mls/models/photo.rb
|
120
|
+
- lib/mls/models/tour_request.rb
|
109
121
|
- lib/mls/models/use.rb
|
110
122
|
- lib/mls/models/user.rb
|
111
123
|
- lib/mls/parser.rb
|
@@ -118,6 +130,19 @@ files:
|
|
118
130
|
- lib/mls/resource.rb
|
119
131
|
- lib/mls/version.rb
|
120
132
|
- mls.gemspec
|
133
|
+
- test/test_helper.rb
|
134
|
+
- test/units/models/test_account.rb
|
135
|
+
- test/units/models/test_address.rb
|
136
|
+
- test/units/models/test_listing.rb
|
137
|
+
- test/units/models/test_photo.rb
|
138
|
+
- test/units/models/test_tour_request.rb
|
139
|
+
- test/units/properties/test_boolean.rb
|
140
|
+
- test/units/test_errors.rb
|
141
|
+
- test/units/test_mls.rb
|
142
|
+
- test/units/test_model.rb
|
143
|
+
- test/units/test_parser.rb
|
144
|
+
- test/units/test_property.rb
|
145
|
+
- test/units/test_resource.rb
|
121
146
|
homepage: http://mls.42floors.com
|
122
147
|
licenses: []
|
123
148
|
post_install_message:
|
@@ -142,4 +167,17 @@ rubygems_version: 1.8.15
|
|
142
167
|
signing_key:
|
143
168
|
specification_version: 3
|
144
169
|
summary: 42Floors MLS Client
|
145
|
-
test_files:
|
170
|
+
test_files:
|
171
|
+
- test/test_helper.rb
|
172
|
+
- test/units/models/test_account.rb
|
173
|
+
- test/units/models/test_address.rb
|
174
|
+
- test/units/models/test_listing.rb
|
175
|
+
- test/units/models/test_photo.rb
|
176
|
+
- test/units/models/test_tour_request.rb
|
177
|
+
- test/units/properties/test_boolean.rb
|
178
|
+
- test/units/test_errors.rb
|
179
|
+
- test/units/test_mls.rb
|
180
|
+
- test/units/test_model.rb
|
181
|
+
- test/units/test_parser.rb
|
182
|
+
- test/units/test_property.rb
|
183
|
+
- test/units/test_resource.rb
|