Class: MLS::Tour
Defined Under Namespace
Classes: Parser
Instance Attribute Summary collapse
Attributes inherited from Resource
#errors, #persisted
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Resource
#==, #create!, inherited, #initialize, #new_record?, #persisted?, #properties, #properties_excluded_from_comparison, #properties_for_comparison, #save, #save!, #set_default_values, #to_hash, #to_key, #update!, #update_attributes
Constructor Details
This class inherits a constructor from MLS::Resource
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
13
14
15
|
# File 'lib/mls/models/tour.rb', line 13
def client
@client
end
|
#listing ⇒ Object
Returns the value of attribute listing.
13
14
15
|
# File 'lib/mls/models/tour.rb', line 13
def listing
@listing
end
|
Class Method Details
.create(listing_id, account, tour = {}) ⇒ Object
52
53
54
55
56
|
# File 'lib/mls/models/tour.rb', line 52
def create(listing_id, account, tour={})
params = {:account => account, :tour => tour}
response = MLS.post("/listings/#{listing_id}/tours", params)
return MLS::Tour::Parser.parse(response.body)
end
|
.find_by_token(token) ⇒ Object
47
48
49
50
|
# File 'lib/mls/models/tour.rb', line 47
def find_by_token(token)
response = MLS.get("/tours/#{token}")
MLS::Tour::Parser.parse(response.body)
end
|
.get_all_for_account ⇒ Object
Instance Method Details
#claim(agent) ⇒ Object
15
16
17
18
|
# File 'lib/mls/models/tour.rb', line 15
def claim(agent)
self.agent_id = agent.id
MLS.post("/tours/#{token}/claim", {:agent_id => agent.id})
end
|
33
34
35
|
# File 'lib/mls/models/tour.rb', line 33
def claimed?
status == "claimed"
end
|
#decline(notes = nil) ⇒ Object
20
21
22
23
|
# File 'lib/mls/models/tour.rb', line 20
def decline(notes=nil)
self. = notes
MLS.post("/tours/#{token}/decline", {:agent_comments => notes})
end
|
37
38
39
|
# File 'lib/mls/models/tour.rb', line 37
def declined?
status == "declined"
end
|
#view ⇒ Object
25
26
27
|
# File 'lib/mls/models/tour.rb', line 25
def view
MLS.post("/tours/#{token}/view")
end
|
29
30
31
|
# File 'lib/mls/models/tour.rb', line 29
def viewed?
status != "new"
end
|