mls 0.6.3 → 0.6.4

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: ecbbe9c12420f935bcd09b1e39fd43fb021c2cb0
4
- data.tar.gz: 435e4c69e13499c7134181a5655ed22b0f9168a4
3
+ metadata.gz: 4e7b94b3481a3cc79638043772e3ef0b37f2edce
4
+ data.tar.gz: 18c406b48b04203b4bec4286bbcd3230d8bb7a12
5
5
  SHA512:
6
- metadata.gz: bb07af7e1004d60d8c42d1f8949a3916b1d8440cda56c6f5d0778bd3d050ecdf8e6ac067790ca53b1e9220995eca86aa3428360a8ebf5f6f75ea6e4fd2fb8ce5
7
- data.tar.gz: 9a34c3538af05983f5fa1993d8ad3de22405f5da0247aa3958d5eea3d0faefce915f05b1bba585690c526c7fc039202469c159fa36a3426e12e98b52ad242696
6
+ metadata.gz: 1a1af89e8d290f0dc52ff7900dd19d96e83c7f2d15313799c39d5a9943a99f3b76c6896f6aa9ed367ce038bbc4233944d6bc18231fc2686c11f64d68dfcf9722
7
+ data.tar.gz: ed4d7835472a05591ad641e25943fa3b58fb18753f064da168782a701aafaae0663ac91e41fca9e6169aab0d32fa2ed4742ffd55e596a61a0da0a42df3237f04
data/lib/mls.rb CHANGED
@@ -434,7 +434,7 @@ require 'mls/models/address'
434
434
  require 'mls/models/photo'
435
435
  require 'mls/models/video'
436
436
  require 'mls/models/pdf'
437
- require 'mls/models/tour'
437
+ require 'mls/models/contact'
438
438
  require 'mls/models/flyer'
439
439
  require 'mls/models/floorplan'
440
440
  require 'mls/models/region'
@@ -1,4 +1,4 @@
1
- class MLS::Tour < MLS::Resource
1
+ class MLS::Contact < MLS::Resource
2
2
  property :id, Fixnum
3
3
  property :status, String
4
4
  property :client_id, Fixnum
@@ -14,16 +14,16 @@ class MLS::Tour < MLS::Resource
14
14
 
15
15
  def claim(agent)
16
16
  self.agent_id = agent.id
17
- MLS.post("/tours/#{token}/claim", {:agent_id => agent.id})
17
+ MLS.post("/contacts/#{token}/claim", {:agent_id => agent.id})
18
18
  end
19
19
 
20
20
  def decline(notes=nil)
21
21
  self.agent_comments = notes
22
- MLS.post("/tours/#{token}/decline", {:agent_comments => notes})
22
+ MLS.post("/contacts/#{token}/decline", {:agent_comments => notes})
23
23
  end
24
24
 
25
25
  def view
26
- MLS.post("/tours/#{token}/view")
26
+ MLS.post("/contacts/#{token}/view")
27
27
  end
28
28
 
29
29
  def viewed?
@@ -40,25 +40,25 @@ class MLS::Tour < MLS::Resource
40
40
 
41
41
  class << self
42
42
  def get_all_for_account
43
- response = MLS.get('/account/tours')
44
- MLS::Tour::Parser.parse_collection(response.body)
43
+ response = MLS.get('/account/contacts')
44
+ MLS::Contact::Parser.parse_collection(response.body)
45
45
  end
46
46
 
47
47
  def find_by_token(token)
48
- response = MLS.get("/tours/#{token}")
49
- MLS::Tour::Parser.parse(response.body)
48
+ response = MLS.get("/contacts/#{token}")
49
+ MLS::Contact::Parser.parse(response.body)
50
50
  end
51
51
 
52
- def create(listing_id, account, tour={})
53
- params = {:account => account, :tour => tour}
54
- response = MLS.post("/listings/#{listing_id}/tours", params)
55
- return MLS::Tour::Parser.parse(response.body)
52
+ def create(listing_id, account, contact={})
53
+ params = {:account => account, :contact => contact}
54
+ response = MLS.post("/listings/#{listing_id}/contacts", params)
55
+ return MLS::Contact::Parser.parse(response.body)
56
56
  end
57
57
  end
58
58
 
59
59
  end
60
60
 
61
- class MLS::Tour::Parser < MLS::Parser
61
+ class MLS::Contact::Parser < MLS::Parser
62
62
 
63
63
  def listing=(listing)
64
64
  @object.listing = MLS::Listing::Parser.build(listing)
@@ -137,14 +137,14 @@ class MLS::Listing < MLS::Resource
137
137
 
138
138
 
139
139
 
140
- # Creates a tour request for the listing.
140
+ # Creates a contact request for the listing.
141
141
  #
142
142
  # Paramaters::
143
143
  #
144
144
  # * +account+ - A +Hash+ of the user account. Valid keys are:
145
- # * +:name+ - Name of the User requesting the tour (Required)
146
- # * +:email+ - Email of the User requesting the tour (Required)
147
- # * +:phone+ - Phone of the User requesting the tour
145
+ # * +:name+ - Name of the User requesting the contact (Required)
146
+ # * +:email+ - Email of the User requesting the contact (Required)
147
+ # * +:phone+ - Phone of the User requesting the contact
148
148
  # * +info+ - A optional +Hash+ of *company* info. Valid keys are:
149
149
  # * +:message+ - Overrides the default message on the email sent to the broker
150
150
  # * +:company+ - The name of the company that is interested in the space
@@ -156,11 +156,11 @@ class MLS::Listing < MLS::Resource
156
156
  # #!ruby
157
157
  # listing = MLS::Listing.find(@id)
158
158
  # info => {:company => 'name', :population => 10, :funding => 'string', :move_id => '2012-09-12'}
159
- # listing.request_tour('name', 'email@address.com', info) # => #<MLS::Tour>
159
+ # listing.request_contact('name', 'email@address.com', info) # => #<MLS::Contact>
160
160
  #
161
- # listing.request_tour('', 'emai', info) # => #<MLS::Tour> will have errors on account
162
- def request_tour(account, tour={})
163
- MLS::Tour.create(id, account, tour)
161
+ # listing.request_contact('', 'emai', info) # => #<MLS::Contact> will have errors on account
162
+ def request_contact(account, contact={})
163
+ MLS::Contact.create(id, account, contact)
164
164
  end
165
165
 
166
166
 
@@ -4,7 +4,6 @@ class MLS::Region < MLS::Resource
4
4
  property :name, String, :serialize => false
5
5
  property :proper_name, String, :serialize => :if_present
6
6
  property :common_name, String, :serialize => :if_present
7
- property :description, String, :serialize => :if_present
8
7
  property :code, String, :serialize => :if_present
9
8
  property :type, String, :serialize => :if_present
10
9
  property :source, String, :serialize => :if_present
data/mls.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mls"
6
- s.version = '0.6.3'
6
+ s.version = '0.6.4'
7
7
  s.authors = ["James R. Bracy", "Jon Bracy"]
8
8
  s.email = ["james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
@@ -1,5 +1,5 @@
1
1
  FactoryGirl.define do
2
- factory :tour, :class => MLS::Tour do
2
+ factory :contact, :class => MLS::Contact do
3
3
  message { Faker::Lorem.paragraph }
4
4
  company { Faker::Company.email }
5
5
  population { Kernel.rand(2..200) }
@@ -1,26 +1,26 @@
1
1
  require 'test_helper'
2
2
 
3
- class TestTour < ::Test::Unit::TestCase
3
+ class TestContact < ::Test::Unit::TestCase
4
4
 
5
5
  # def test_properties
6
- # tr = MLS::Tour.new
6
+ # tr = MLS::Contact.new
7
7
  #
8
8
  # assert tr.respond_to?(:message)
9
9
  # end
10
10
  #
11
11
  # def test_attr_accessors
12
- # tr = MLS::Tour.new
12
+ # tr = MLS::Contact.new
13
13
  #
14
14
  # assert tr.respond_to?(:listing)
15
15
  # end
16
16
  #
17
17
  # def test_class_methods
18
- # assert MLS::Tour.respond_to?(:get_all_for_account)
19
- # assert MLS::Tour.respond_to?(:create)
18
+ # assert MLS::Contact.respond_to?(:get_all_for_account)
19
+ # assert MLS::Contact.respond_to?(:create)
20
20
  # end
21
21
  #
22
22
  # def test_parser
23
- # assert defined?(MLS::Tour::Parser)
23
+ # assert defined?(MLS::Contact::Parser)
24
24
  # end
25
25
 
26
26
  test 'it' do
@@ -60,11 +60,11 @@ class TestListing < ::Test::Unit::TestCase
60
60
  assert MLS::Listing.respond_to?(:find)
61
61
  end
62
62
 
63
- test '#request_tour for email without an account' do
63
+ test '#request_contact for email without an account' do
64
64
  @listing = FactoryGirl.create(:listing)
65
65
  @name = Faker::Name.name
66
66
  @email = Faker::Internet.email
67
- tr = @listing.request_tour(@name, @email)
67
+ tr = @listing.request_contact(@name, @email)
68
68
 
69
69
 
70
70
  assert_equal({}, tr.errors)
@@ -73,66 +73,66 @@ class TestListing < ::Test::Unit::TestCase
73
73
  assert tr.id
74
74
  end
75
75
 
76
- test '#request_tour for email on a ghost account' do
76
+ test '#request_contact for email on a ghost account' do
77
77
  @account = FactoryGirl.create(:ghost_account)
78
78
  @listing = FactoryGirl.create(:listing)
79
79
 
80
- tr = @listing.request_tour(@account.name, @account.email)
80
+ tr = @listing.request_contact(@account.name, @account.email)
81
81
  assert_equal({}, tr.errors)
82
82
  assert_equal({}, tr.account.errors)
83
83
  # TODO assert_equal({}, tr.listing.errors)
84
84
  assert tr.id
85
85
  end
86
86
 
87
- test '#request_tour for email on an account' do
87
+ test '#request_contact for email on an account' do
88
88
  @account = FactoryGirl.create(:account)
89
89
  @listing = FactoryGirl.create(:listing)
90
90
 
91
- tr = @listing.request_tour(@account.name, @account.email)
91
+ tr = @listing.request_contact(@account.name, @account.email)
92
92
  assert_equal({}, tr.errors)
93
93
  assert_equal({}, tr.account.errors)
94
94
  # TODO assert_equal({}, tr.listing.errors)
95
95
  assert tr.id
96
96
  end
97
97
 
98
- test '#request_tour for an non-existant listing' do
98
+ test '#request_contact for an non-existant listing' do
99
99
  @listing = FactoryGirl.build(:listing, :id => 94332)
100
100
 
101
101
  assert_raises(MLS::Exception::NotFound) do
102
- @listing.request_tour(Faker::Name.name, Faker::Internet.email)
102
+ @listing.request_contact(Faker::Name.name, Faker::Internet.email)
103
103
  end
104
104
  end
105
105
 
106
- test '#request_tour without and account name' do
106
+ test '#request_contact without and account name' do
107
107
  @listing = FactoryGirl.create(:listing)
108
108
 
109
- tr = @listing.request_tour('', Faker::Internet.email)
109
+ tr = @listing.request_contact('', Faker::Internet.email)
110
110
  assert !tr.id
111
111
  assert_equal({:name => ["can't be blank"]}, tr.account.errors)
112
112
 
113
- tr = @listing.request_tour(nil, Faker::Internet.email)
113
+ tr = @listing.request_contact(nil, Faker::Internet.email)
114
114
  assert !tr.id
115
115
  assert_equal({:name => ["can't be blank"]}, tr.account.errors)
116
116
  end
117
117
 
118
- test '#request_tour without an account email' do
118
+ test '#request_contact without an account email' do
119
119
  @listing = FactoryGirl.create(:listing)
120
120
 
121
- tr = @listing.request_tour(Faker::Name.name, '')
121
+ tr = @listing.request_contact(Faker::Name.name, '')
122
122
  assert !tr.id
123
123
  assert_equal({:email => ["can't be blank", "is invalid"]}, tr.account.errors)
124
124
 
125
- tr = @listing.request_tour(Faker::Name.name, nil)
125
+ tr = @listing.request_contact(Faker::Name.name, nil)
126
126
  assert !tr.id
127
127
  # assert !tr.persisted? #TODO move to persisted being based of id?
128
128
  assert_equal({:email => ["can't be blank", "is invalid"]}, tr.account.errors)
129
129
  end
130
130
 
131
- test '#request_tour with an account email' do
131
+ test '#request_contact with an account email' do
132
132
  @account = FactoryGirl.create(:account)
133
133
  @listing = FactoryGirl.create(:listing)
134
134
 
135
- tr = @listing.request_tour('', @account.email) # TODO should this try to set the name of the account?
135
+ tr = @listing.request_contact('', @account.email) # TODO should this try to set the name of the account?
136
136
  assert_equal({}, tr.errors)
137
137
  assert_equal({}, tr.account.errors)
138
138
  # TODO assert_equal({}, tr.listing.errors)
@@ -140,17 +140,17 @@ class TestListing < ::Test::Unit::TestCase
140
140
  assert tr.persisted?
141
141
  end
142
142
 
143
- test '#request_tour multiple times for a listing' do
143
+ test '#request_contact multiple times for a listing' do
144
144
  @account = FactoryGirl.create(:account)
145
145
  @listing = FactoryGirl.create(:listing)
146
146
 
147
- tr1 = @listing.request_tour(@account.name, @account.email)
147
+ tr1 = @listing.request_contact(@account.name, @account.email)
148
148
  assert_equal({}, tr1.errors) # TODO should errors be here for account?
149
149
  assert_equal({}, tr1.account.errors)
150
150
  # TODO assert_equal({}, tr.listing.errors)
151
151
  assert tr1.persisted?
152
152
 
153
- tr2 = @listing.request_tour(@account.name, @account.email)
153
+ tr2 = @listing.request_contact(@account.name, @account.email)
154
154
  assert_equal({}, tr2.errors)
155
155
  assert_equal({}, tr2.account.errors)
156
156
  # TODO assert_equal({}, tr.listing.errors)
@@ -159,11 +159,11 @@ class TestListing < ::Test::Unit::TestCase
159
159
  assert_not_equal tr1.id, tr2.id
160
160
  end
161
161
 
162
- test '#request_tour with optional info' do
162
+ test '#request_contact with optional info' do
163
163
  @listing = FactoryGirl.create(:listing)
164
164
 
165
165
  info = {:company => '42Floors', :population => 10, :funding => 'string thing', :move_in_date => '2012-09-12'}
166
- tr = @listing.request_tour(Faker::Name.name, Faker::Internet.email, info)
166
+ tr = @listing.request_contact(Faker::Name.name, Faker::Internet.email, info)
167
167
 
168
168
  assert tr.id
169
169
  assert_equal '42Floors', info[:company]
@@ -171,7 +171,7 @@ class TestListing < ::Test::Unit::TestCase
171
171
  assert_equal 'string thing', info[:funding]
172
172
  assert_equal '2012-09-12', info[:move_in_date]
173
173
 
174
- tr = @listing.request_tour('', nil, info)
174
+ tr = @listing.request_contact('', nil, info)
175
175
  assert !tr.id
176
176
  assert_equal '42Floors', info[:company]
177
177
  assert_equal 10, info[:population]
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.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James R. Bracy
@@ -195,13 +195,13 @@ files:
195
195
  - lib/mls/model.rb
196
196
  - lib/mls/models/account.rb
197
197
  - lib/mls/models/address.rb
198
+ - lib/mls/models/contact.rb
198
199
  - lib/mls/models/floorplan.rb
199
200
  - lib/mls/models/flyer.rb
200
201
  - lib/mls/models/listing.rb
201
202
  - lib/mls/models/pdf.rb
202
203
  - lib/mls/models/photo.rb
203
204
  - lib/mls/models/region.rb
204
- - lib/mls/models/tour.rb
205
205
  - lib/mls/models/video.rb
206
206
  - lib/mls/parser.rb
207
207
  - lib/mls/properties/array.rb
@@ -237,16 +237,16 @@ files:
237
237
  - mls.gemspec
238
238
  - test/factories/account.rb
239
239
  - test/factories/address.rb
240
+ - test/factories/contact.rb
240
241
  - test/factories/listing.rb
241
- - test/factories/tour.rb
242
242
  - test/fixtures/flyer.pdf
243
243
  - test/test_helper.rb
244
244
  - test/units/models/test_account.rb
245
245
  - test/units/models/test_address.rb
246
+ - test/units/models/test_contact.rb
246
247
  - test/units/models/test_flyer.rb
247
248
  - test/units/models/test_listing.rb
248
249
  - test/units/models/test_photo.rb
249
- - test/units/models/test_tour.rb
250
250
  - test/units/properties/test_boolean.rb
251
251
  - test/units/test_errors.rb
252
252
  - test/units/test_mls.rb
@@ -280,16 +280,16 @@ summary: 42Floors MLS Client
280
280
  test_files:
281
281
  - test/factories/account.rb
282
282
  - test/factories/address.rb
283
+ - test/factories/contact.rb
283
284
  - test/factories/listing.rb
284
- - test/factories/tour.rb
285
285
  - test/fixtures/flyer.pdf
286
286
  - test/test_helper.rb
287
287
  - test/units/models/test_account.rb
288
288
  - test/units/models/test_address.rb
289
+ - test/units/models/test_contact.rb
289
290
  - test/units/models/test_flyer.rb
290
291
  - test/units/models/test_listing.rb
291
292
  - test/units/models/test_photo.rb
292
- - test/units/models/test_tour.rb
293
293
  - test/units/properties/test_boolean.rb
294
294
  - test/units/test_errors.rb
295
295
  - test/units/test_mls.rb