tourets 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ module TouRETS
17
17
  # There must be a rets_config.yml file in the :rails_root/config directory
18
18
  #
19
19
  def establish_connection(mls)
20
+ close_connection if current_connection?
20
21
  config_file = File.join(app_root, 'config', 'rets_config.yml')
21
22
  if File.exists?(config_file)
22
23
  connections = YAML.load_file(config_file)
@@ -3,20 +3,21 @@ module TouRETS
3
3
  include Utilities
4
4
  extend Utilities
5
5
 
6
- SEARCH_QUERY_DEFAULTS = {:active_properties => "ER,EA,C", :idx_display => "Y", :internet_display => "Y"}
6
+ SEARCH_QUERY_DEFAULTS = {:listing_status => "ER,EA,C", :idx_display => "Y", :internet_display => "Y"}
7
7
  # This class searches for ResidentialProperty, Condo, SingleFamily, Rental
8
8
  # Some MLS use "1", some use :RES... Will need to decide which way is to be used.
9
9
  SEARCH_CONFIG_DEFAULTS = {:search_type => :Property, :class => "1"}
10
10
 
11
11
  class << self
12
12
 
13
- # Returns an array of all of the properties
13
+ # Returns an array of all of the properties. Same as calling where() with no options
14
+ # TODO: figure out why it limits to 5,000 records.
14
15
  # Property.all
15
16
  def all
16
17
  where
17
18
  end
18
19
 
19
- # Returns an array of property results.
20
+ # Returns an array of property results. A Property is defined as ["Single Family Residential", "Manufactured Home", "Condominium", "Townhouse"]
20
21
  # Property.where(:bedrooms => 7, :bathrooms => 4, :list_price => 200000..300000)
21
22
  # Property.where(:property_type => {:not => ['CONDO', 'TOWNHOME']}, :area => {:or => ['South West', 'North West']})
22
23
  # Property.where(:area => ['South West', 'North West']) # This is like 'AND'
@@ -33,13 +34,13 @@ module TouRETS
33
34
 
34
35
  # # Propert.where(:bedrooms => 3).limit(10) #not implemented
35
36
  # def limit(limit_number = 5000)
36
- # SEARCH_CONFIG_DEFAULTS.merge!(:limit => limit_number)
37
+ # {:limit => limit_number}
37
38
  # self
38
39
  # end
39
40
  #
40
41
  # # Property.where(:bedrooms => 3).count #not implemented
41
42
  # def count
42
- # SEARCH_CONFIG_DEFAULTS.merge!(:count_mode => :only)
43
+ # {:count_mode => :only}
43
44
  # self
44
45
  # end
45
46
  #
@@ -63,12 +64,13 @@ module TouRETS
63
64
  @photos ||= grab_photos
64
65
  end
65
66
 
67
+ # Look for one of the mapped keys, and return the value or throw method missing error.
66
68
  def method_missing(method_name, *args, &block)
67
- val = attributes[key_map[method_name.to_sym]]
68
- if val.nil?
69
- super
69
+ mapped_key = key_map[method_name.to_sym]
70
+ if attributes.has_key?(mapped_key)
71
+ attributes[mapped_key]
70
72
  else
71
- return val
73
+ super
72
74
  end
73
75
  end
74
76
 
@@ -1,6 +1,6 @@
1
1
  module TouRETS
2
2
  module Rails
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
 
5
5
  end
6
6
  end
@@ -41,7 +41,7 @@ module TouRETS
41
41
  :dryer_hookup => "34", #String
42
42
  :area => "37", #String
43
43
  :association_fee => "39", #Integer
44
- #1st Encumbr Assumption Desc => "43" # Like the mortgage...
44
+ :initial_encumber_desc => "43",#String
45
45
  :three_quarter_baths => "60", #Integer
46
46
  :bathrooms => "61", #Integer
47
47
  :half_baths => "62", #Integer
@@ -105,9 +105,86 @@ module TouRETS
105
105
  :sewer => "219", #String
106
106
  # #Loft => "231", #Integer
107
107
  :has_spa => "236", #Boolean
108
- :active_properties => "242",
109
- :idx_display => "1809",
110
- :sqft => "2361"
108
+ :living_area_size => "237", #Integer
109
+ :listing_status => "242", #String
110
+ :street_name => "243", #String
111
+ :street_number => "244", #String
112
+ :subdivision_name => "247", #String
113
+ :style_desc => "257", #String
114
+ :unit_number => "258", #String
115
+ :laundry_location => "260", #String
116
+ :water_desc => "261", #String
117
+ :year_built => "264", #Integer
118
+ :zoning => "266", #String
119
+ :property_desc => "268", #String
120
+ :garage_desc => "269", #String
121
+ :roof_desc => "270", #String
122
+ :lot_desc => "271", #String
123
+ :spa_desc => "272", #String
124
+ :pool_desc => "273", #String
125
+ :directions => "274", #String
126
+ :dining_room_desc => "276", #String
127
+ :family_room_desc => "277", #String
128
+ :kitchen_desc => "278", #String
129
+ :living_room_desc => "279", #String
130
+ :master_bath_desc => "280", #String
131
+ :master_bedroom_desc => "281",#String
132
+ :bedroom_2_desc => "282", #String
133
+ :bedroom_3_desc => "283", #String
134
+ :bedroom_4_desc => "284", #String
135
+ :oven_desc => "289", #String
136
+ :other_appliance_desc => "290", #String
137
+ :construction_desc => "291", #String
138
+ :interior_desc => "292", #String
139
+ :flooring_desc => "293", #String
140
+ :fireplace_desc => "294", #String
141
+ :fence_type => "295", #String
142
+ :equestrian_desc => "296", #String
143
+ :direction_house_faces => "297", #String
144
+ :misc_desc => "298", #String
145
+ :exterior_desc => "299",
146
+ :landscape_desc => "300",
147
+ :heating_desc => "301",
148
+ :heating_fuel_desc => "302",
149
+ :cooling_system => "303",
150
+ :utility_info => "304",
151
+ :energy_desc => "305",
152
+ :estimated_closing_date => "1736", #DateTime
153
+ :original_price_sqft => "1740", #Integer
154
+ :idx_display => "1809", #String
155
+ :vr_tour_link => "2139", #String
156
+ :last_image_trans_date => "2238", #DateTime
157
+ :sqft => "2361", #Integer
158
+ :xp_unit_number => "2363",
159
+ :short_sale? => "2369", #Boolean
160
+ :elementary_school =>"2377",
161
+ :total_possible_bedrooms => "2379",
162
+ :days_list_to_close => "2381",
163
+ :unit_num => "2386",
164
+ :ammenities_desc => "2388",
165
+ :bath_downstairs? => "2392", #Boolean
166
+ :bedroom_downstairs? => "2394", #Boolean
167
+ :building_desc => "2414",
168
+ :fireplace_location => "2422",
169
+ :foreclosure_commened => "2424", #String
170
+ :furnishings_desc => "2426",
171
+ :has_great_room? => "2428", #Boolean
172
+ :great_room_dim => "2430",
173
+ :great_room_desc => "2432",
174
+ :parking_desc => "2438",
175
+ :washer_included? => "2440",
176
+ :dryer_included? => "2442",
177
+ :house_views => "2450",
178
+ :subtype => "2452",
179
+ :den_dim => "2511",
180
+ :unit_desc => "2543",
181
+ :repo => "2660", #String
182
+ :has_public_address => "2858", #Boolean
183
+ :commentary? => "2859", #Boolean
184
+ :avm? => "2860", #Boolean
185
+ :public_address => "2861",
186
+ :auction_date => "2878", #DateTime
187
+ :auction_type => "2879"
111
188
  }
112
189
  end
113
190
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tourets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-16 00:00:00.000000000 Z
13
+ date: 2012-11-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby-rets
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: 3840694011043471350
120
+ hash: -615199931025625643
121
121
  required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: 3840694011043471350
129
+ hash: -615199931025625643
130
130
  requirements: []
131
131
  rubyforge_project:
132
132
  rubygems_version: 1.8.24