caboose-rets 0.1.49 → 0.1.50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74c64118a76ae1e263e39e9dd4d580a3d42e6d05
4
- data.tar.gz: 3d5ad8d3589b13942b162096645a7ca44478e647
3
+ metadata.gz: 1756dcd0abed50589db685c67d40f4e077500a8f
4
+ data.tar.gz: b6a2f6c3fa9ef703fe99ff44cca2a8339b0aa3a9
5
5
  SHA512:
6
- metadata.gz: 80f97431ed216b7e9a2d70116914c09067f5a834e1f85c53069b3239eca4e5bdf6d31d8adf89386fb7412fa82b553fe51479adda54912a28dc3b0b99260097fe
7
- data.tar.gz: dc38ffef4246c787ca522efe9c68cc777fd1032658236119b0684c4f84afaa00ee25b33b90f9545c9efde47d668fd6ec8c34162de6e3518a8d568b3a7c13ca5f
6
+ metadata.gz: 496d184eeae28d399f8a14de196511e02cd35685ec54d7062fba38857f9ee9e15ff8eeb25f2f45676d50bc8634d15fd3a14cb4ac9663436368ba6ec01525b9f7
7
+ data.tar.gz: 5a8896eed9d229800cdea018c566e6c2bf39cc17c569f6ae513ab7f0aa4762852969a78bc76762345804b06820affd122b6d7a42db9d98d8ef45de89fbaae425
@@ -172,5 +172,20 @@ module CabooseRets
172
172
  render :json => resp
173
173
  end
174
174
 
175
+ # @route GET /rets/feed/:fieldtype
176
+ def facebook_feed
177
+ rc = CabooseRets::RetsConfig.where(:site_id => @site.id).first
178
+ if params[:fieldtype] == 'agent' && rc && !rc.agent_mls.blank?
179
+ @properties = CabooseRets::Property.where("list_agent_mls_id = ?", rc.agent_mls).order("original_entry_timestamp DESC").take(100)
180
+ elsif params[:fieldtype] == 'office' && rc && !rc.office_mls.blank?
181
+ @properties = CabooseRets::Property.where("list_office_mls_id = ?", rc.office_mls).order("original_entry_timestamp DESC").take(100)
182
+ else
183
+ @properties = CabooseRets::Property.order("original_entry_timestamp DESC").take(100)
184
+ end
185
+ respond_to do |format|
186
+ format.rss { render :layout => false }
187
+ end
188
+ end
189
+
175
190
  end
176
191
  end
@@ -24,6 +24,10 @@ class CabooseRets::Property <ActiveRecord::Base
24
24
  CabooseRets::Office.where(:lo_mls_id => self.list_office_mls_id).first
25
25
  end
26
26
 
27
+ def full_address
28
+ "#{self.street_number} #{self.street_name.blank? ? '' : self.street_name.titleize} #{self.street_suffix.blank? ? '' : self.street_suffix.titleize}"
29
+ end
30
+
27
31
  def parse(data)
28
32
  # puts(data.to_s)
29
33
  # self.access = nil
@@ -0,0 +1,36 @@
1
+ domain = Caboose::Domain.where(:site_id => @site.id, :primary => true).first.domain
2
+ hp = Caboose::Page.where(:site_id => @site.id, :title => "Home").first
3
+ xml.instruct! :xml, :version => "1.0"
4
+ xml.rss :version => "2.0", "xmlns:g" => "http://base.google.com/ns/1.0" do
5
+ xml.channel do
6
+ xml.title @site.description
7
+ xml.description hp ? hp.meta_description : @site.description
8
+ xml.link "https://" + domain
9
+ xml.language "en"
10
+ for property in @properties
11
+ xml.item do
12
+ xml.g(:id, property.mls_number)
13
+ xml.g(:title, property.full_address)
14
+ xml.g(:description, property.public_remarks)
15
+ xml.g(:link, "https://" + domain + "/properties/#{property.mls_number}/details")
16
+ first_image = property.images.first if property.images
17
+ m = Caboose::Media.where(:id => first_image.media_id).first if first_image && !first_image.media_id.blank?
18
+ if m && m.image
19
+ xml.g(:image_link, "https:" + m.image.url(:large))
20
+ else
21
+ xml.g(:image_link, 'https://cabooseit.s3.amazonaws.com/rets/house.png')
22
+ end
23
+ if !property.construction_status.blank?
24
+ if property.construction_status.include?('New') || property.construction_status.include?('Under Construction') || property.construction_status.include?('Proposed Construction')
25
+ xml.g(:condition, 'new')
26
+ else
27
+ xml.g(:condition, 'used')
28
+ end
29
+ end
30
+ xml.g(:price, number_to_currency(property.list_price) + " USD")
31
+ xml.g(:availability, 'in stock')
32
+ xml.g(:brand, @site.description)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.49'
2
+ VERSION = '0.1.50'
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.1.49
4
+ version: 0.1.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-10 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms
@@ -80,6 +80,7 @@ files:
80
80
  - app/views/caboose_rets/properties/admin_edit.html.erb
81
81
  - app/views/caboose_rets/properties/admin_index.html.erb
82
82
  - app/views/caboose_rets/properties/details.html.erb
83
+ - app/views/caboose_rets/properties/facebook_feed.rss.builder
83
84
  - app/views/caboose_rets/properties/index.html.erb
84
85
  - app/views/caboose_rets/properties/property_not_exists.html.erb
85
86
  - app/views/caboose_rets/properties/test_form.html.erb