caboose-rets 0.0.40 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWFlMzdjNzVlNmVhOWI4MWI4OTc2ZmNhNTAyNmE0ZTdkMmU3MjllYw==
4
+ ZWI3M2FlN2I5YjQ2NmFjY2UyYWYzNDUxYWNlNzlmNGEzMWY0OTNjZA==
5
5
  data.tar.gz: !binary |-
6
- NTJkMTUyNTU4MjQxYjUyMGMyMTVmZmVlOGQ2ZGQ2YjhmMGRhYTBjMQ==
6
+ MjAzYTI1Yjg2YWRmZWI2ZjNiNzM2OTk5MmU3NTk1ZGMzNzZiOGQxNg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Mzk1ODJkMjljZTQ3MGM1ODJjY2Q1OTY2YjUyNDQ2Zjk1MmYxYTZhNmQzNTc3
10
- Y2Q0ODE2ZTdmYTA3ZDAzMWU1NmQ0MGJhYWQwZWZjMzcyMTQ0MDFmMDY2ZTBk
11
- ODA3ODAwYzk5ZjBkZWVkYzBhNDk5YTg2ZjQwOWY5YzUxNzU0MDE=
9
+ Njk5MTcxNWJhMzZhN2I4NjFjOWNlNzMxM2QyOTJiN2ExOWRlNjQxMjFkNWI1
10
+ Y2EwNDJhOGUzN2E1MmRiZmFlMTNlNTZiYzJhOTI4MWY1MmZhZGM2N2U5ZDU0
11
+ NWQ0ZjQ5NDQxNGJhNzEwNjE5MzZiMjViZThmNjA0OTU1ZmM1Y2U=
12
12
  data.tar.gz: !binary |-
13
- NTdkNTVmYTEzODU5Mzg5MGYzZTU5MGViY2U3MDZmNWE5NGEyODE1NTEzM2Ey
14
- MDk5YTAyMWJmZGUyOWRhMjc5YjI0YTU2MTY4ODQxN2U0Y2ZmMDE3NzBiNzk0
15
- NjgyMjJlZmMzNTY0Zjc3ZTE3NDM4MzkxNTYxMmMxNGYzYjBhNzk=
13
+ ZTNjMjkwMzA1YTQ2NTBkZDFkZjhlNzRmNzc5Njc3NzgwYjM5MjkwNTE5MDhk
14
+ YzVlODg1MjJiZmM4NGEyNjE2MjkxZWY4N2M4ZmY3OGJjYzEwNWIzYTVkM2M1
15
+ NmQ2NTE1ZGJhNTY0OWUwOTkyMzQ4NDYzNmZiNTNhM2Y1ZmNiYmQ=
@@ -317,10 +317,17 @@ module CabooseRets
317
317
 
318
318
  # GET /admin/commercial/:mls_acct/refresh
319
319
  def admin_refresh
320
- p = CommercialProperty.find(params[:mls_acct])
321
- RetsImporter.import("(MLS_ACCT=#{p.mls_acct})", 'Property', 'COM')
322
- RetsImporter.download_property_images(p)
323
- render :json => Caboose::StdClass.new({ 'success' => "The property's info has been updated from MLS." })
320
+ return if !user_is_allowed('properties', 'edit')
321
+
322
+ p = CommercialProperty.find(params[:mls_acct])
323
+ p.delay.refresh_from_mls
324
+
325
+ #RetsImporter.import("(MLS_ACCT=#{p.mls_acct})", 'Property', 'COM')
326
+ #RetsImporter.download_property_images(p)
327
+
328
+ resp = Caboose::StdClass.new
329
+ resp.success = "The property's info is being updated from MLS. This may take a few minutes depending on how many images it has."
330
+ render :json => resp
324
331
  end
325
332
  end
326
333
  end
@@ -110,14 +110,18 @@ module CabooseRets
110
110
  return if !user_is_allowed('properties', 'edit')
111
111
  @property = LandProperty.where(:mls_acct => params[:mls_acct]).first
112
112
  render :layout => 'caboose/admin'
113
- end
114
-
113
+ end
114
+
115
115
  # GET /admin/land/:mls_acct/refresh
116
116
  def admin_refresh
117
- p = LandProperty.find(params[:mls_acct])
118
- RetsImporter.import("(MLS_ACCT=#{p.mls_acct})", 'Property', 'LND')
119
- RetsImporter.download_property_images(p)
120
- render :json => Caboose::StdClass.new({ 'success' => "The property's info has been updated from MLS." })
117
+ return if !user_is_allowed('properties', 'edit')
118
+
119
+ p = LandProperty.find(params[:mls_acct])
120
+ p.delay.refresh_from_mls
121
+
122
+ resp = Caboose::StdClass.new
123
+ resp.success = "The property's info is being updated from MLS. This may take a few minutes depending on how many images it has."
124
+ render :json => resp
121
125
  end
122
126
 
123
127
  end
@@ -107,11 +107,17 @@ module CabooseRets
107
107
  end
108
108
 
109
109
  # GET /admin/residential/:mls_acct/refresh
110
- def admin_refresh
111
- p = ResidentialProperty.find(params[:mls_acct])
112
- RetsImporter.import("(MLS_ACCT=#{p.mls_acct})", 'Property', 'RES')
113
- RetsImporter.download_property_images(p)
114
- render :json => Caboose::StdClass.new({ 'success' => "The property's info has been updated from MLS." })
110
+ def admin_refresh
111
+ return if !user_is_allowed('properties', 'edit')
112
+
113
+ p = ResidentialProperty.find(params[:mls_acct])
114
+ p.delay.refresh_from_mls
115
+ #RetsImporter.import("(MLS_ACCT=#{p.mls_acct})", 'Property', 'RES')
116
+ #RetsImporter.download_property_images(p)
117
+
118
+ resp = Caboose::StdClass.new
119
+ resp.success = "The property's info is being updated from MLS. This may take a few minutes depending on how many images it has."
120
+ render :json => resp
115
121
  end
116
122
 
117
123
  end
@@ -1,6 +1,7 @@
1
1
 
2
2
  class CabooseRets::CommercialProperty < ActiveRecord::Base
3
3
  self.table_name = "rets_commercial"
4
+ attr_accessible :id, :mls_acct
4
5
 
5
6
  def url() return "/commercial/#{self.id}" end
6
7
  def agent() return CabooseRets::Agent.where(:la_code => self.la_code).first end
@@ -13,6 +14,17 @@ class CabooseRets::CommercialProperty < ActiveRecord::Base
13
14
  return media.url
14
15
  end
15
16
  def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end
17
+
18
+ def refresh_from_mls
19
+ CabooseRets::RetsImporter.import("(MLS_ACCT=#{self.mls_acct})", 'Property', 'COM')
20
+ CabooseRets::RetsImporter.download_property_images(self)
21
+ end
22
+
23
+ def self.import_from_mls(mls_acct)
24
+ CabooseRets::RetsImporter.import("(MLS_ACCT=*#{mls_acct}*)", 'Property', 'COM')
25
+ p = self.find(mls_acct.to_i)
26
+ CabooseRets::RetsImporter.download_property_images(p)
27
+ end
16
28
 
17
29
  def parse(data)
18
30
  self.acreage = data['ACREAGE']
@@ -1,6 +1,7 @@
1
1
 
2
2
  class CabooseRets::LandProperty < ActiveRecord::Base
3
3
  self.table_name = "rets_land"
4
+ attr_accessible :id, :mls_acct
4
5
 
5
6
  def url() return "/land/#{self.id}" end
6
7
  def agent() return CabooseRets::Agent.where(:la_code => self.la_code).first end
@@ -13,6 +14,17 @@ class CabooseRets::LandProperty < ActiveRecord::Base
13
14
  return media.url
14
15
  end
15
16
  def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end
17
+
18
+ def refresh_from_mls
19
+ CabooseRets::RetsImporter.import("(MLS_ACCT=#{self.mls_acct})", 'Property', 'LND')
20
+ CabooseRets::RetsImporter.download_property_images(self)
21
+ end
22
+
23
+ def self.import_from_mls(mls_acct)
24
+ CabooseRets::RetsImporter.import("(MLS_ACCT=*#{mls_acct}*)", 'Property', 'LND')
25
+ p = self.find(mls_acct.to_i)
26
+ CabooseRets::RetsImporter.download_property_images(p)
27
+ end
16
28
 
17
29
  def parse(data)
18
30
  self.acreage = data['ACREAGE']
@@ -1,6 +1,7 @@
1
1
 
2
2
  class CabooseRets::MultiFamilyProperty < ActiveRecord::Base
3
3
  self.table_name = "rets_multi_family"
4
+ attr_accessible :id, :mls_acct
4
5
 
5
6
  def url() return "/multi-family/#{self.id}" end
6
7
  def agent() return CabooseRets::Agent.where(:la_code => self.la_code).first end
@@ -13,6 +14,17 @@ class CabooseRets::MultiFamilyProperty < ActiveRecord::Base
13
14
  return media.url
14
15
  end
15
16
  def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end
17
+
18
+ def refresh_from_mls
19
+ CabooseRets::RetsImporter.import("(MLS_ACCT=#{self.mls_acct})", 'Property', 'MUL')
20
+ CabooseRets::RetsImporter.download_property_images(self)
21
+ end
22
+
23
+ def self.import_from_mls(mls_acct)
24
+ CabooseRets::RetsImporter.import("(MLS_ACCT=*#{mls_acct}*)", 'Property', 'MUL')
25
+ p = self.find(mls_acct.to_i)
26
+ CabooseRets::RetsImporter.download_property_images(p)
27
+ end
16
28
 
17
29
  def parse(data)
18
30
  self.acreage = data['ACREAGE']
@@ -1,6 +1,7 @@
1
1
 
2
2
  class CabooseRets::ResidentialProperty < ActiveRecord::Base
3
3
  self.table_name = "rets_residential"
4
+ attr_accessible :id, :mls_acct
4
5
 
5
6
  def url() return "/residential/#{self.id}" end
6
7
  def agent() return CabooseRets::Agent.where(:la_code => self.la_code).first end
@@ -13,6 +14,17 @@ class CabooseRets::ResidentialProperty < ActiveRecord::Base
13
14
  return media.url
14
15
  end
15
16
  def self.geolocatable() all(conditions: "latitude IS NOT NULL AND longitude IS NOT NULL") end
17
+
18
+ def refresh_from_mls
19
+ CabooseRets::RetsImporter.import("(MLS_ACCT=#{self.mls_acct})", 'Property', 'RES')
20
+ CabooseRets::RetsImporter.download_property_images(self)
21
+ end
22
+
23
+ def self.import_from_mls(mls_acct)
24
+ CabooseRets::RetsImporter.import("(MLS_ACCT=*#{mls_acct}*)", 'Property', 'RES')
25
+ p = self.find(mls_acct.to_i)
26
+ CabooseRets::RetsImporter.download_property_images(p)
27
+ end
16
28
 
17
29
  def parse(data)
18
30
  self.bedrooms = data['BEDROOMS']
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.0.40'
2
+ VERSION = '0.0.41'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.40
4
+ version: 0.0.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms