Permalink
Browse files

Supporting the updated tour requests.

  • Loading branch information...
1 parent e230763 commit 9c6ca00856bdae36583e6813ecf3e314fe81b22f @waratuman waratuman committed Jun 13, 2013
Showing with 16 additions and 35 deletions.
  1. +15 −34 lib/mls/models/tour_request.rb
  2. +1 −1 mls.gemspec
@@ -1,42 +1,27 @@
class MLS::TourRequest < MLS::Resource
- property :message, String
-
property :id, Fixnum
- property :account_id, Fixnum
- property :listing_id, Fixnum
- property :contact_id, Fixnum
- property :message, String
- property :company, String
- property :population, String
- property :growing, Boolean
- property :updated_by_id, Fixnum
property :status, String
- property :reasons_to_decline, String, :serialize => :if_present
-
+ property :client_id, Fixnum
+ property :agent_id, Fixnum
+ property :listing_id, Fixnum
+ property :comments, String
+ property :agent_comments, String, :serialize => :if_present
property :token, String, :serialize => :false
-
property :created_at, DateTime, :serialize => :false
property :updated_at, DateTime, :serialize => :false
- attr_accessor :account, :listing, :additional_features
+ attr_accessor :client, :listing
def claim(agent)
- MLS.post("/tour_requests/#{token}/claim", {:agent_id => agent.id}) do |response, code|
- return code == 200
- end
+ MLS.post("/tour_requests/#{token}/claim", {:agent_id => agent.id})
end
- def decline(agent, reasons=nil)
- MLS.post("/tour_requests/#{token}/decline",
- {:agent_id => agent.id, :reasons_to_decline => reasons}) do |response, code|
- return code == 200
- end
+ def decline(comments=nil)
+ MLS.post("/tour_requests/#{token}/decline", {:agent_comments => reasons})
end
- def view(agent)
- MLS.post("/tour_requests/#{token}/view", {:agent_id => agent.id}) do |response, code|
- return code == 200
- end
+ def view
+ MLS.post("/tour_requests/#{token}/view")
end
def viewed?
@@ -51,12 +36,6 @@ def declined?
status == "declined"
end
- def to_hash
- hash = super
- hash[:additional_features_attributes] = additional_features.to_hash if additional_features
- hash
- end
-
class << self
def get_all_for_account
response = MLS.get('/account/tour_requests')
@@ -74,6 +53,7 @@ def create(listing_id, account, tour={})
return MLS::TourRequest::Parser.parse(response.body)
end
end
+
end
class MLS::TourRequest::Parser < MLS::Parser
@@ -82,7 +62,8 @@ def listing=(listing)
@object.listing = MLS::Listing::Parser.build(listing)
end
- def account=(account)
- @object.account = MLS::Account::Parser.build(account)
+ def client=(account)
+ @object.client = MLS::Account::Parser.build(account)
end
+
end
View
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = "mls"
- s.version = '0.3.8'
+ s.version = '0.4.0'
s.authors = ["James R. Bracy", "Jon Bracy"]
s.email = ["james@42floors.com"]
s.homepage = "http://mls.42floors.com"

0 comments on commit 9c6ca00

Please sign in to comment.