mls 0.2.19 → 0.2.20

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.
@@ -8,29 +8,56 @@ class MLS::TourRequest < MLS::Resource
8
8
  property :company, String
9
9
  property :population, String
10
10
  property :growing, Boolean
11
+ property :updated_by_id, Fixnum
12
+ property :status, String
13
+ property :reasons_to_decline, String, :serialize => :if_present
14
+
15
+ property :token, String, :serialize => :false
16
+
11
17
  property :created_at, DateTime, :serialize => :false
12
18
  property :updated_at, DateTime, :serialize => :false
13
19
 
14
20
  attr_accessor :account, :listing
15
21
 
16
22
  def claim(agent)
17
- MLS.post("/tour_requests/#{id}/claim", {:agent_id => agent.id}) do |response, code|
18
- if code == 200
19
- true
20
- else
21
- false
22
- end
23
+ MLS.post("/tour_requests/#{token}/claim", {:agent_id => agent.id}) do |response, code|
24
+ return code == 200
25
+ end
26
+ end
27
+
28
+ def decline(agent, reasons=nil)
29
+ MLS.post("/tour_requests/#{token}/decline",
30
+ {:agent_id => agent.id, :reasons_to_decline => reasons}) do |response, code|
31
+ return code == 200
32
+ end
33
+ end
34
+
35
+ def mark_viewed(agent)
36
+ MLS.post("/tour_requests/#{token}/mark_viewed", {:agent_id => agent.id}) do |response, code|
37
+ return code == 200
23
38
  end
24
39
  end
25
40
 
41
+ def viewed?
42
+ status != "new"
43
+ end
44
+
45
+ def claimed?
46
+ status == "claimed"
47
+ end
48
+
49
+ def declined?
50
+ status == "declined"
51
+ end
52
+
26
53
  class << self
27
54
  def get_all_for_account
28
55
  response = MLS.get('/account/tour_requests')
29
56
  MLS::TourRequest::Parser.parse_collection(response.body)
30
57
  end
31
58
 
32
- def find(id)
33
- response = MLS.get("/tour_requests/#{id}")
59
+ def find_by_token(token)
60
+ response = MLS.get("/tour_requests/#{token}")
34
61
  MLS::TourRequest::Parser.parse(response.body)
35
62
  end
36
63
  end
@@ -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.19'
6
+ s.version = '0.2.20'
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.19
4
+ version: 0.2.20
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-11 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  version: '0'
282
282
  requirements: []
283
283
  rubyforge_project: mls
284
- rubygems_version: 1.8.23
284
+ rubygems_version: 1.8.24
285
285
  signing_key:
286
286
  specification_version: 3
287
287
  summary: 42Floors MLS Client