mls 0.2.20 → 0.2.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -139,9 +139,7 @@ class MLS::Listing < MLS::Resource
139
139
  #
140
140
  # listing.request_tour('', 'emai', info) # => #<MLS::TourRequest> will have errors on account
141
141
  def request_tour(account, tour={})
142
- params = {:account => account, :tour => tour}
143
- response = MLS.post("/listings/#{id}/tour_requests", params)
144
- return MLS::TourRequest::Parser.parse(response.body)
142
+ MLS::TourRequest.create(id, account, tour)
145
143
  end
146
144
 
147
145
 
@@ -12,12 +12,12 @@ class MLS::TourRequest < MLS::Resource
12
12
  property :status, String
13
13
  property :reasons_to_decline, String, :serialize => :if_present
14
14
 
15
- property :token, String, :serialize => :false
15
+ property :token, String, :serialize => :false
16
16
 
17
17
  property :created_at, DateTime, :serialize => :false
18
18
  property :updated_at, DateTime, :serialize => :false
19
19
 
20
- attr_accessor :account, :listing
20
+ attr_accessor :account, :listing, :additional_features
21
21
 
22
22
  def claim(agent)
23
23
  MLS.post("/tour_requests/#{token}/claim", {:agent_id => agent.id}) do |response, code|
@@ -50,6 +50,12 @@ class MLS::TourRequest < MLS::Resource
50
50
  status == "declined"
51
51
  end
52
52
 
53
+ def to_hash
54
+ hash = super
55
+ hash[:additional_features_attributes] = additional_features.to_hash if additional_features
56
+ hash
57
+ end
58
+
53
59
  class << self
54
60
  def get_all_for_account
55
61
  response = MLS.get('/account/tour_requests')
@@ -58,8 +64,15 @@ class MLS::TourRequest < MLS::Resource
58
64
 
59
65
  def find_by_token(token)
60
66
  response = MLS.get("/tour_requests/#{token}")
67
+ puts response.body
61
68
  MLS::TourRequest::Parser.parse(response.body)
62
69
  end
70
+
71
+ def create(listing_id, account, tour={})
72
+ params = {:account => account, :tour => tour}
73
+ response = MLS.post("/listings/#{listing_id}/tour_requests", params)
74
+ return MLS::TourRequest::Parser.parse(response.body)
75
+ end
63
76
  end
64
77
  end
65
78
 
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.2.20'
6
+ s.version = '0.2.21'
7
7
  s.authors = ["James R. Bracy"]
8
8
  s.email = ["james@42floors.com"]
9
9
  s.homepage = "http://mls.42floors.com"
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.20
4
+ version: 0.2.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake