Class: MLS::Floorplan
Defined Under Namespace
Classes: Parser
Instance Attribute Summary
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
Class Method Details
.create(attrs) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/mls/models/floorplan.rb', line 19
def self.create(attrs)
attrs[:file].rewind
url = MLS.url.dup
url.user = nil
url.path = "/api/floorplans"
if attrs[:subject]
attrs[:subject_id] = attrs[:subject].id
attrs[:subject_type] = attrs[:subject].class.name.split("::").last
attrs.delete(:subject)
end
response = RestClient.post(url.to_s, {:floorplan => attrs}, MLS.)
attrs[:file].close unless attrs[:file].closed?
MLS::Floorplan::Parser.parse(response.body)
end
|
.find(id) ⇒ Object
36
37
38
39
|
# File 'lib/mls/models/floorplan.rb', line 36
def self.find(id)
response = MLS.get("/floorplans/#{id}")
MLS::Floorplan::Parser.parse(response.body)
end
|
Instance Method Details
#avatar(size = '150x100', protocol = 'http') ⇒ Object
15
16
17
|
# File 'lib/mls/models/floorplan.rb', line 15
def avatar(size='150x100', protocol='http')
"#{protocol}://#{MLS.asset_host}/photos/#{size}/#{avatar_digest}.jpg"
end
|
#url(protocol = 'http') ⇒ Object
11
12
13
|
# File 'lib/mls/models/floorplan.rb', line 11
def url(protocol='http')
"#{protocol}://#{MLS.asset_host}/floorplans/#{digest}/#{file_name}"
end
|