caboose-rets 0.0.6 → 0.0.7

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
- ZjZhMTdjZWFlNmQ0Y2JiYTNhNjhiNmRmM2Q4NTUyYThiNDE0NzZjYQ==
4
+ ZDVjYTg5ODIxYzFjNmJjYmFiYmU5ZTIyOTAzMTkzNDdiNzFhMzEyMg==
5
5
  data.tar.gz: !binary |-
6
- ZTlhOTIxNjRmMzJkODMzMjVjNzdhMjQyZDNmN2U5YTUzODMyYWEzMg==
6
+ ZmMxY2E4YjQ1YTU0YmI2YmIzZTkzMjVkZWUxNDI2ZjdmZWEyNWMzZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTg0NGRhNGYxYzg0YTUxNDAyMzVjYmFhODYzYzY2NWE4MmM0MTdkMWRmODcz
10
- ZGI0MjFiM2FlYjMxNzllNjYxNWE4NTNlYmVhYWVmMzE5Mjk3NzFlMGI5Nzc3
11
- YjU5NWE3ZjQ3N2YxMjIyZTFiMGRmM2RhMWQ0Y2ZkYzljODVmNTk=
9
+ Y2I2ZDZlNmRiNTJjYzk1NzcwMjI2YTI1YjI5MTExYmNhYjdmMDViZDZlNjYx
10
+ ZDI2MDcxNjZhZTNmZTYzMjM4NDEzMDU2ZmZlMmQzNTc5Njk5NjliMGQ0NjY2
11
+ MDEyMDliMTFhYmFlMGM4NzM1Njc0YWI1YzdlYzVhZTg3Zjc5ZTQ=
12
12
  data.tar.gz: !binary |-
13
- ZTg2ZTUyODEzZThhMjNjMDNhMDk3YWMzNTgyMGUxNDdiODc0MTRkMGI3Y2Ey
14
- YWE5NWUzMTQyZDkyM2QyMjQ3NzI4YWU2MGEzNjcwZjM0YmI0NzA3ZTVjNGFl
15
- ZjgzMTU1YWRhYzUzMDg5ZWI5MjZjNWViZjFiNGE1MDc0YjhmZTI=
13
+ ZTgzZmY3ZjAwOTVmMjA2ODA1MDUzNjk5YjA3YmQxM2ZmMGE5M2NjYWI5ZmQw
14
+ MDE5Njg4YjBkZDE4ZDFiZWZiOWQyZmUxMWIxNDA2ZWU1OTk5ZDJmODM2OTQz
15
+ NjFjMjAzYzBhYWY4NjU5MjQ0YzY5MDk4OWU4ZGM4Y2EzYzY4ZjA=
@@ -4,8 +4,8 @@ module CabooseRets
4
4
 
5
5
  # GET /agents
6
6
  def index
7
- @agents = Agent.where("lo_code = '46' AND hide IS false").order("last_name, first_name")
8
- @agent = Agent.where(:la_code => '048540000').first
7
+ @agents = Agent.where("lo_code = '46' AND hide IS false").order("last_name, first_name")
8
+ @agent = Agent.where(:la_code => '048540000').first
9
9
  @assistants = Agent.where(:assistant_to => '048540000').order("last_name, first_name")
10
10
  end
11
11
 
@@ -1,60 +1,17 @@
1
1
  require "open-uri"
2
2
 
3
3
  module CabooseRets
4
- class OpenHousesController < ApplicationController
5
-
6
- # GET /admin/open-houses/new
7
- def admin_new
8
- return if !user_is_allowed('post', 'new')
9
- @post = Caboose::Post.new
10
- render :layout => 'caboose/admin'
11
- end
4
+ class OpenHousesController < ApplicationController
12
5
 
13
- # POST /admin/open-houses
14
- def admin_add
15
- return if !user_is_allowed('post', 'add')
16
-
17
- resp = Caboose::StdClass.new({
18
- 'error' => nil,
19
- 'redirect' => nil
20
- })
21
-
22
- mls = params[:mls]
23
- post = post_from_mls(mls)
24
-
25
- if post.nil?
26
- resp.error = "No property with MLS id #{params[:mls]}."
27
- else
28
- post.published = false
29
- post.save
30
- resp.redirect = "/admin/posts/#{post.id}/edit"
31
- end
32
-
33
- render :json => resp
6
+ # get /open-houses
7
+ def index
8
+ @open_houses = OpenHouse.where("open_house_type = 'PUB' and open_house_date > '#{DateTime.now.strftime("%F")}'").reorder("open_house_date, start_time").all
34
9
  end
35
10
 
36
- def post_from_mls(mls)
37
- post = nil
38
- [ResidentialProperty, CommercialProperty, CommercialProperty].each_with_index do |type, i|
39
-
40
- prop = type.find(mls)
41
- next if prop.nil?
42
- ptype = ['residential', 'commercial', 'land'][i]
43
-
44
- d = params[:date_time]
45
- post = Caboose::Post.new
46
- post.title = "Open House on #{d} at #{prop.street_num.to_s} #{prop.street_name.titleize}"
47
-
48
- post.body = ""
49
- post.body << "<p>#{prop.remarks}</p>" if prop.remarks and !prop.remarks.strip.empty?
50
- post.body << "\n<p>Directions: #{prop.directions}</p>" if prop.directions and !prop.directions.strip.empty?
51
- post.body << "\n<p><a href='/#{ptype}/#{prop.id}/details'>More details</a></p>"
52
-
53
- post.image = open("https://s3.amazonaws.com/advantagerealtygroup.com/#{ptype}/#{mls}_1_original.jpg")
54
-
55
- break
56
- end
57
- return post
11
+ # get /open-houses/:id
12
+ def details
13
+ @open_houses = OpenHouse.find(params[:id])
58
14
  end
15
+
59
16
  end
60
17
  end
@@ -2,6 +2,20 @@
2
2
  class CabooseRets::OpenHouse < ActiveRecord::Base
3
3
  self.table_name = "rets_open_houses"
4
4
 
5
+ def property
6
+ models = [CabooseRets::ResidentialProperty, CabooseRets::CommercialProperty, CabooseRets::LandProperty, CabooseRets::MultiFamilyProperty]
7
+ models.each do |model|
8
+ id = self.mls_acct.to_i
9
+ return model.find(id) if model.exists?(id)
10
+ end
11
+ return nil
12
+ end
13
+
14
+ def agent
15
+ return CabooseRets::Agent.where(:la_code => self.la_code).first if CabooseRets::Agent.exists?(:la_code => self.la_code)
16
+ return nil
17
+ end
18
+
5
19
  def parse(data)
6
20
  self.id = data['ID']
7
21
  self.comments = data['COMMENTS']
@@ -185,7 +185,10 @@ class CabooseRets::RetsImporter # < ActiveRecord::Base
185
185
  end
186
186
  return
187
187
  end
188
-
188
+ self.download_agent_images(agent)
189
+ end
190
+
191
+ def self.download_agent_images(agent)
189
192
  a = agent
190
193
  self.log "Saving image for #{a.first_name} #{a.last_name}..."
191
194
  begin
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-05 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms