caboose-rets 0.1.53 → 0.1.54

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: e08b84acc3e27ed82756c0b97cf5e29d8add62ed
4
- data.tar.gz: 6c3d064f937c4b07cb0aa5456970036a08684d49
3
+ metadata.gz: 4232b424d7599a62c39bae58f0adc5d88a0005a2
4
+ data.tar.gz: 71f0d315846370b9ba1dcfa686b02e023cdf1b94
5
5
  SHA512:
6
- metadata.gz: a9bb0a734fa30ee9388d9062ef3cacf73bbe55cc4ced71485b90cd5c662e4d932b31cd15a8908d8ecf8e97b8665e3016dc0cf5f9a06bef212adeb492d9bcb137
7
- data.tar.gz: 02c9652ec23319a738cd48d4cc0c18f711dc5d1cfed7ef39f275b542b1f17662d58921f1b98b0eafcaa53a32ce8ed4ce30602693d3fa4f662057b1f58ef677b8
6
+ metadata.gz: aa54eb798c50bdd0a4fec802e07dab35a0def9028cc883bcb2c44d8e4ca151cd7636a4158c829cedb73ac4080e19566d42766cbd6897f0dd1588e179221bb762
7
+ data.tar.gz: 7d0f5ba24fa421ae274b3684a7f8cb40f71d964165f1f4862bbbda53449df49a94370d0994aec430f944285a484fd0ccfce0b679d98a6922c2eb455f59084b8e
@@ -172,8 +172,23 @@ module CabooseRets
172
172
  render :json => resp
173
173
  end
174
174
 
175
- # @route GET /rets/feed/:fieldtype
176
- def facebook_feed
175
+ # @route GET /rets/products-feed/:fieldtype
176
+ def facebook_products_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
+
190
+ # @route GET /rets/listings-feed/:fieldtype
191
+ def facebook_listings_feed
177
192
  rc = CabooseRets::RetsConfig.where(:site_id => @site.id).first
178
193
  if params[:fieldtype] == 'agent' && rc && !rc.agent_mls.blank?
179
194
  @properties = CabooseRets::Property.where("list_agent_mls_id = ?", rc.agent_mls).order("original_entry_timestamp DESC").take(100)
@@ -0,0 +1,62 @@
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.listings do
6
+ xml.title @site.description
7
+ # xml.description hp ? hp.meta_description : @site.description
8
+ xml.link(("https://" + domain), :rel => "self")
9
+ # xml.language "en"
10
+ for property in @properties
11
+ xml.listing do
12
+ kind = "#{property.res_style} #{property.style} #{property.property_type} #{property.property_subtype}"
13
+ xml.home_listing_id(property.mls_number)
14
+ xml.name(property.full_address)
15
+ xml.availability('for_sale')
16
+ xml.description(property.public_remarks)
17
+ xml.address :format => "simple" do
18
+ xml.component(property.full_address, :name => "addr1")
19
+ xml.component(property.city, :name => "city")
20
+ xml.component(property.state_or_province, :name => "region")
21
+ xml.component("United States", :name => "country")
22
+ xml.component(property.postal_code, :name => "postal_code")
23
+ end
24
+ xml.image do
25
+ property.images.each do |pi|
26
+ m = Caboose::Media.find(pi.media_id)
27
+ xml.url("https:" + m.image.url(:large)) if m
28
+ end
29
+ end
30
+ xml.latitude(property.latitude.blank? ? '33.2098' : property.latitude)
31
+ xml.longitude(property.longitude.blank? ? '-87.5692' : property.longitude)
32
+ xml.neighborhood(property.subdivision)
33
+ xml.listing_type('for_sale_by_agent')
34
+ xml.num_baths(property.baths_total)
35
+ xml.num_beds(property.beds_total)
36
+ xml.url("https://" + domain + "/properties/#{property.mls_number}/details")
37
+ xml.year_built(property.year_built)
38
+ if !property.property_type.blank?
39
+ if kind.include?('Land')
40
+ xml.property_type('land')
41
+ elsif kind.include?('Commercial')
42
+ xml.property_type('other')
43
+ elsif kind.include?('Condo')
44
+ xml.property_type('condo')
45
+ elsif kind.include?('Town') || kind.include?('Duplex')
46
+ xml.property_type('townhouse')
47
+ elsif kind.include?('Manufactured') || kind.include?('Prefab')
48
+ xml.property_type('manufactured')
49
+ elsif kind.include?('Other')
50
+ xml.property_type('other')
51
+ else
52
+ xml.property_type('house')
53
+ end
54
+ else
55
+ xml.property_type('house')
56
+ end
57
+ xml.price(number_to_currency(property.list_price).gsub("$","") + " USD")
58
+ xml.availability('for_sale')
59
+ end
60
+ end
61
+ # end
62
+ end
@@ -1,3 +1,3 @@
1
1
  module CabooseRets
2
- VERSION = '0.1.53'
2
+ VERSION = '0.1.54'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-rets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.53
4
+ version: 0.1.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
@@ -80,7 +80,8 @@ 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
+ - app/views/caboose_rets/properties/facebook_listings_feed.rss.builder
84
+ - app/views/caboose_rets/properties/facebook_products_feed.rss.builder
84
85
  - app/views/caboose_rets/properties/index.html.erb
85
86
  - app/views/caboose_rets/properties/property_not_exists.html.erb
86
87
  - app/views/caboose_rets/properties/test_form.html.erb