reso 0.1.0.0

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.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +149 -0
  6. data/Rakefile +1 -0
  7. data/app/controllers/syndication_controller.rb +5 -0
  8. data/app/models/.keep +0 -0
  9. data/app/models/address.rb +25 -0
  10. data/app/models/address_type.rb +3 -0
  11. data/app/models/alternate_price.rb +2 -0
  12. data/app/models/appliance.rb +3 -0
  13. data/app/models/architecture_style.rb +5 -0
  14. data/app/models/area_unit.rb +2 -0
  15. data/app/models/brokerage.rb +4 -0
  16. data/app/models/builder.rb +4 -0
  17. data/app/models/business.rb +8 -0
  18. data/app/models/community.rb +5 -0
  19. data/app/models/cooling_system.rb +3 -0
  20. data/app/models/county.rb +5 -0
  21. data/app/models/currency_period.rb +3 -0
  22. data/app/models/enumeration.rb +7 -0
  23. data/app/models/expense.rb +6 -0
  24. data/app/models/expense_category.rb +2 -0
  25. data/app/models/exterior_type.rb +3 -0
  26. data/app/models/floor_covering.rb +3 -0
  27. data/app/models/foreclosure_status.rb +5 -0
  28. data/app/models/franchise.rb +4 -0
  29. data/app/models/gender.rb +3 -0
  30. data/app/models/heating_fuel.rb +3 -0
  31. data/app/models/heating_system.rb +3 -0
  32. data/app/models/home_feature.rb +3 -0
  33. data/app/models/import.rb +16 -0
  34. data/app/models/import_format.rb +3 -0
  35. data/app/models/license_category.rb +2 -0
  36. data/app/models/listing.rb +64 -0
  37. data/app/models/listing_category.rb +5 -0
  38. data/app/models/listing_media.rb +6 -0
  39. data/app/models/listing_provider.rb +9 -0
  40. data/app/models/listing_status.rb +5 -0
  41. data/app/models/multiple_listing_service.rb +5 -0
  42. data/app/models/neighborhood.rb +3 -0
  43. data/app/models/office.rb +6 -0
  44. data/app/models/open_house.rb +4 -0
  45. data/app/models/parking.rb +3 -0
  46. data/app/models/participant.rb +5 -0
  47. data/app/models/participant_license.rb +8 -0
  48. data/app/models/participant_role.rb +3 -0
  49. data/app/models/person.rb +18 -0
  50. data/app/models/photo.rb +3 -0
  51. data/app/models/place.rb +3 -0
  52. data/app/models/price.rb +4 -0
  53. data/app/models/property_sub_type.rb +5 -0
  54. data/app/models/property_type.rb +5 -0
  55. data/app/models/queued_listing.rb +26 -0
  56. data/app/models/roof_type.rb +3 -0
  57. data/app/models/room.rb +4 -0
  58. data/app/models/room_category.rb +2 -0
  59. data/app/models/school.rb +3 -0
  60. data/app/models/school_category.rb +2 -0
  61. data/app/models/source_provider_category.rb +2 -0
  62. data/app/models/tax.rb +3 -0
  63. data/app/models/video.rb +3 -0
  64. data/app/models/view_type.rb +3 -0
  65. data/app/models/virtual_tour.rb +3 -0
  66. data/app/views/syndication/rets.xml.erb +325 -0
  67. data/lib/class_extensions.rb +53 -0
  68. data/lib/generators/reso/install_generator.rb +43 -0
  69. data/lib/generators/reso/setup.rb +36 -0
  70. data/lib/generators/reso/templates/create_addresses.rb +33 -0
  71. data/lib/generators/reso/templates/create_businesses.rb +19 -0
  72. data/lib/generators/reso/templates/create_enumerations.rb +11 -0
  73. data/lib/generators/reso/templates/create_expenses.rb +13 -0
  74. data/lib/generators/reso/templates/create_imports.rb +17 -0
  75. data/lib/generators/reso/templates/create_join_tables.rb +27 -0
  76. data/lib/generators/reso/templates/create_listing_media.rb +19 -0
  77. data/lib/generators/reso/templates/create_listing_providers.rb +12 -0
  78. data/lib/generators/reso/templates/create_listings.rb +154 -0
  79. data/lib/generators/reso/templates/create_multiple_listing_services.rb +11 -0
  80. data/lib/generators/reso/templates/create_offices.rb +29 -0
  81. data/lib/generators/reso/templates/create_open_houses.rb +18 -0
  82. data/lib/generators/reso/templates/create_participant_licenses.rb +13 -0
  83. data/lib/generators/reso/templates/create_participants.rb +26 -0
  84. data/lib/generators/reso/templates/create_people.rb +18 -0
  85. data/lib/generators/reso/templates/create_places.rb +20 -0
  86. data/lib/generators/reso/templates/create_prices.rb +19 -0
  87. data/lib/generators/reso/templates/create_queued_listings.rb +10 -0
  88. data/lib/generators/reso/templates/create_rooms.rb +10 -0
  89. data/lib/generators/reso/templates/create_schools.rb +13 -0
  90. data/lib/generators/reso/templates/create_taxes.rb +12 -0
  91. data/lib/generators/reso/templates/enumerations.csv +748 -0
  92. data/lib/mapper/reso.rb +658 -0
  93. data/lib/mapper.rb +114 -0
  94. data/lib/reso/engine.rb +13 -0
  95. data/lib/reso/railties/reso.rake +128 -0
  96. data/lib/reso/version.rb +3 -0
  97. data/lib/reso.rb +10 -0
  98. data/reso.gemspec +31 -0
  99. metadata +261 -0
@@ -0,0 +1,2 @@
1
+ class SourceProviderCategory < Enumeration
2
+ end
data/app/models/tax.rb ADDED
@@ -0,0 +1,3 @@
1
+ class Tax < ActiveRecord::Base
2
+ belongs_to :listing
3
+ end
@@ -0,0 +1,3 @@
1
+ class Video < ListingMedia
2
+ belongs_to :listing
3
+ end
@@ -0,0 +1,3 @@
1
+ class ViewType < Enumeration
2
+ has_and_belongs_to_many :listings, foreign_key: "enumeration_id"
3
+ end
@@ -0,0 +1,3 @@
1
+ class VirtualTour < ListingMedia
2
+ belongs_to :listing
3
+ end
@@ -0,0 +1,325 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Listings xmlns="http://rets.org/xsd/Syndication/2012-03" xmlns:commons="http://rets.org/xsd/RETSCommons" xmlns:schemaLocation="http://rets.org/xsd/Syndication/2012-03/Syndication.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" listingsKey="2012-03-06T22:14:47" version="0.96" versionTimestamp="2012-02-07T03:00:00Z" xml:lang="en-us">
3
+ <%- @listings.each do |listing| -%>
4
+ <Listing>
5
+ <%- unless listing.address.blank? -%>
6
+ <Address>
7
+ <commons:preference-order><%= listing.address.preference_order %></commons:preference-order>
8
+ <commons:address-preference-order><%= listing.address.address_preference_order %></commons:address-preference-order>
9
+ <commons:FullStreetAddress><%= listing.address.full_street_address %></commons:FullStreetAddress>
10
+ <commons:UnitNumber><%= listing.address.unit_number %></commons:UnitNumber>
11
+ <commons:City><%= listing.address.city %></commons:City>
12
+ <commons:StateOrProvince><%= listing.address.state_or_province %></commons:StateOrProvince>
13
+ <commons:PostalCode><%= listing.address.postal_code %></commons:PostalCode>
14
+ <commons:Country><%= listing.address.country %></commons:Country>
15
+ </Address>
16
+ <%- end -%>
17
+ <ListPrice commons:isgSecurityClass="Public"><%= listing.list_price %></ListPrice>
18
+ <ListPriceLow commons:isgSecurityClass="Public"><%= listing.list_price_low %></ListPriceLow>
19
+ <%- # TODO: AlternatePrices -%>
20
+ <ListingURL>http://www.somemls.com/lisings/1234567890</ListingURL>
21
+ <ProviderName><%= listing.listing_provider.name %></ProviderName>
22
+ <ProviderURL><%= listing.listing_provider.url %></ProviderURL>
23
+ <ProviderCategory><%= listing.listing_provider.source_provider_category.name %></ProviderCategory>
24
+ <LeadRoutingEmail><%= listing.lead_routing_email %></LeadRoutingEmail>
25
+ <Bedrooms><%= listing.bedrooms %></Bedrooms>
26
+ <Bathrooms><%= listing.bathrooms %></Bathrooms>
27
+ <%- # TODO: PropertyType otherDescription="Ranch" -%>
28
+ <%- # TODO: PropertySubType otherDescription="Ranch" -%>
29
+ <PropertyType otherDescription=""><%= listing.property_type.name %></PropertyType>
30
+ <PropertySubType otherDescription=""><%= listing.property_sub_type.name %></PropertySubType>
31
+ <ListingKey><%= listing.listing_key %></ListingKey>
32
+ <ListingCategory><%= listing.listing_category.name %></ListingCategory>
33
+ <ListingStatus><%= listing.listing_status.name %></ListingStatus>
34
+ <MarketingInformation>
35
+ <commons:PermitAddressOnInternet commons:isgSecurityClass="Public"><%= listing.permit_address_on_internet %></commons:PermitAddressOnInternet>
36
+ <commons:VOWAddressDisplay commons:isgSecurityClass="Public"><%= listing.vow_address_display %></commons:VOWAddressDisplay>
37
+ <commons:VOWAutomatedValuationDisplay commons:isgSecurityClass="Public"><%= listing.vow_automated_valuation_display %></commons:VOWAutomatedValuationDisplay>
38
+ <commons:VOWConsumerComment commons:isgSecurityClass="Public"><%= listing.vow_consumer_comment %></commons:VOWConsumerComment>
39
+ </MarketingInformation>
40
+ <%- unless listing.photos.blank? -%>
41
+ <Photos>
42
+ <%- listing.photos.each do |photo| -%>
43
+ <Photo>
44
+ <MediaModificationTimestamp commons:isgSecurityClass="Public"><%= photo.media_modification_timestamp %></MediaModificationTimestamp>
45
+ <MediaURL><%= photo.media_url %></MediaURL>
46
+ <MediaCaption><%= photo.media_caption %></MediaCaption>
47
+ <MediaDescription><%= photo.media_description %></MediaDescription>
48
+ </Photo>
49
+ <%- end -%>
50
+ </Photos>
51
+ <%- end -%>
52
+ <DiscloseAddress><%= listing.disclose_address %></DiscloseAddress>
53
+ <ShortSale><%= listing.short_sale %></ShortSale>
54
+ <ListingDescription><%= listing.listing_description %></ListingDescription>
55
+ <MlsId><%= listing.listing_service.identifier %></MlsId>
56
+ <MlsName><%= listing.listing_service.name %></MlsName>
57
+ <MlsNumber><%= listing.listing_service_identifier %></MlsNumber>
58
+ <LivingArea><%= listing.living_area %></LivingArea>
59
+ <LotSize><%= listing.lot_size %></LotSize>
60
+ <YearBuilt><%= listing.year_built %></YearBuilt>
61
+ <ListingDate><%= listing.listing_date %></ListingDate>
62
+ <ListingTitle><%= listing.listing_title %></ListingTitle>
63
+ <FullBathrooms><%= listing.full_bathrooms unless listing.full_bathrooms.zero? %></FullBathrooms>
64
+ <ThreeQuarterBathrooms><%= listing.three_quarter_bathrooms unless listing.three_quarter_bathrooms.zero? %></ThreeQuarterBathrooms>
65
+ <HalfBathrooms><%= listing.half_bathrooms unless listing.half_bathrooms.zero? %></HalfBathrooms>
66
+ <OneQuarterBathrooms><%= listing.one_quarter_bathrooms unless listing.one_quarter_bathrooms.zero? %></OneQuarterBathrooms>
67
+ <ForeclosureStatus>REO - Bank Owned</ForeclosureStatus>
68
+ <ListingParticipants>
69
+ <Participant>
70
+ <ParticipantKey>3yd-A2SELL-12345</ParticipantKey>
71
+ <ParticipantId>12345</ParticipantId>
72
+ <FirstName>John</FirstName>
73
+ <LastName>Doe</LastName>
74
+ <Role>Listing</Role>
75
+ <PrimaryContactPhone>555555lead</PrimaryContactPhone>
76
+ <OfficePhone>555555555</OfficePhone>
77
+ <Email>l.0.null.null.2@leads.listhub.net</Email>
78
+ <Fax>555-555-5555</Fax>
79
+ <WebsiteURL>http://www.somemls.com/agents/12345</WebsiteURL>
80
+ </Participant>
81
+ </ListingParticipants>
82
+ <VirtualTours>
83
+ <VirtualTour>
84
+ <MediaModificationTimestamp commons:isgSecurityClass="Public">2012-03-04T17:14:47-05:00</MediaModificationTimestamp>
85
+ <MediaURL>http://virtualtour.com/listing/10923921</MediaURL>
86
+ <MediaCaption>my virtual tour</MediaCaption>
87
+ <MediaDescription>come see this property</MediaDescription>
88
+ </VirtualTour>
89
+ </VirtualTours>
90
+ <Videos>
91
+ <Video>
92
+ <MediaModificationTimestamp commons:isgSecurityClass="Public">2012-03-04T17:14:47-05:00</MediaModificationTimestamp>
93
+ <MediaURL>http://videos.listhub.com/listing/u93422/1</MediaURL>
94
+ <MediaCaption>Awesome View</MediaCaption>
95
+ <MediaDescription>This property overlooks downtown Morgantown</MediaDescription>
96
+ </Video>
97
+ </Videos>
98
+ <Offices>
99
+ <Office>
100
+ <OfficeKey>3yd-A2SELL-OC1</OfficeKey>
101
+ <OfficeId>OC1</OfficeId>
102
+ <Level>???</Level>
103
+ <OfficeCode>
104
+ <OfficeCodeId>OC1</OfficeCodeId>
105
+ </OfficeCode>
106
+ <Name>Preview Listing Office</Name>
107
+ <CorporateName>Preview Listing Office</CorporateName>
108
+ <BrokerId>br0ker1d</BrokerId>
109
+ <PhoneNumber>555-555-555</PhoneNumber>
110
+ <Address>
111
+ <commons:preference-order>1</commons:preference-order>
112
+ <commons:address-preference-order>1</commons:address-preference-order>
113
+ <commons:FullStreetAddress>2245 Don Knotts Blvd.</commons:FullStreetAddress>
114
+ <commons:UnitNumber>2</commons:UnitNumber>
115
+ <commons:City>Morgantown</commons:City>
116
+ <commons:StateOrProvince>WV</commons:StateOrProvince>
117
+ <commons:PostalCode>26501</commons:PostalCode>
118
+ <commons:Country>USA</commons:Country>
119
+ </Address>
120
+ <Website>http://www.listoffice.com</Website>
121
+ </Office>
122
+ </Offices>
123
+ <Brokerage>
124
+ <Name>John Doe</Name>
125
+ <Phone>555-555-lead</Phone>
126
+ <Email>l.0.null.null.0@leads.listhub.net</Email>
127
+ <WebsiteURL>http://johndoebrokerage.com/</WebsiteURL>
128
+ <LogoURL>http://johndoebrokerage.com/logo.png</LogoURL>
129
+ <Address>
130
+ <commons:preference-order>1</commons:preference-order>
131
+ <commons:address-preference-order>1</commons:address-preference-order>
132
+ <commons:FullStreetAddress>2245 Don Knotts Blvd.</commons:FullStreetAddress>
133
+ <commons:UnitNumber>2</commons:UnitNumber>
134
+ <commons:City>Morgantown</commons:City>
135
+ <commons:StateOrProvince>WV</commons:StateOrProvince>
136
+ <commons:PostalCode>26501</commons:PostalCode>
137
+ <commons:Country>true</commons:Country>
138
+ </Address>
139
+ </Brokerage>
140
+ <Franchise>
141
+ <Name>Advanced</Name>
142
+ </Franchise>
143
+ <Builder>
144
+ <Name>Building Builders</Name>
145
+ <Phone>999-999-9998</Phone>
146
+ <Fax>999-999-9999</Fax>
147
+ <Email>email@building.com</Email>
148
+ <WebsiteURL>http://www.buildingbuilders.com</WebsiteURL>
149
+ <Address>
150
+ <commons:preference-order>1</commons:preference-order>
151
+ <commons:address-preference-order>1</commons:address-preference-order>
152
+ <commons:FullStreetAddress>2245 Don Knotts Blvd.</commons:FullStreetAddress>
153
+ <commons:City>Morgantown</commons:City>
154
+ <commons:StateOrProvince>WV</commons:StateOrProvince>
155
+ <commons:PostalCode>26501</commons:PostalCode>
156
+ </Address>
157
+ </Builder>
158
+ <Location>
159
+ <Latitude>39.231</Latitude>
160
+ <Longitude>-89.9383</Longitude>
161
+ <Elevation>1000ft</Elevation>
162
+ <Directions>Down the road, take a left, ford the stream, left at roundabout</Directions>
163
+ <GeocodeOptions>WGS84</GeocodeOptions>
164
+ <County>Monongalia</County>
165
+ <ParcelId>12321</ParcelId>
166
+ <Community>
167
+ <commons:Subdivision commons:isgSecurityClass="Public">Cheat Crossings</commons:Subdivision>
168
+ <commons:Schools>
169
+ <commons:School>
170
+ <commons:Name>Valley View</commons:Name>
171
+ <commons:SchoolCategory>Elementary</commons:SchoolCategory>
172
+ <commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
173
+ <commons:Description>true</commons:Description>
174
+ </commons:School>
175
+ <commons:School>
176
+ <commons:Name>MHS</commons:Name>
177
+ <commons:SchoolCategory>High</commons:SchoolCategory>
178
+ <commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
179
+ <commons:Description>true</commons:Description>
180
+ </commons:School>
181
+ <commons:School>
182
+ <commons:Name>Morgantown Jr High School</commons:Name>
183
+ <commons:SchoolCategory>JuniorHigh</commons:SchoolCategory>
184
+ <commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
185
+ <commons:Description>true</commons:Description>
186
+ </commons:School>
187
+ <commons:School>
188
+ <commons:Name>South</commons:Name>
189
+ <commons:SchoolCategory>Middle</commons:SchoolCategory>
190
+ <commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
191
+ <commons:Description>true</commons:Description>
192
+ </commons:School>
193
+ </commons:Schools>
194
+ </Community>
195
+ <Neighborhoods>
196
+ <Neighborhood>
197
+ <Name>Downtown</Name>
198
+ <Description>Fabulous Downtown Morgantown</Description>
199
+ </Neighborhood>
200
+ <Neighborhood>
201
+ <Name>Industrial</Name>
202
+ <Description>Business opportunities abound</Description>
203
+ </Neighborhood>
204
+ </Neighborhoods>
205
+ </Location>
206
+ <OpenHouses>
207
+ <OpenHouse>
208
+ <Date>2012-03-16</Date>
209
+ <StartTime>5:14 PM</StartTime>
210
+ <EndTime>9:14 PM</EndTime>
211
+ <Description>Come out and see this lovely property!</Description>
212
+ </OpenHouse>
213
+ </OpenHouses>
214
+ <Taxes>
215
+ <Tax>
216
+ <Year>2011</Year>
217
+ <Amount>3400.0</Amount>
218
+ <TaxDescription>tax description1</TaxDescription>
219
+ </Tax>
220
+ <Tax>
221
+ <Year>2010</Year>
222
+ <Amount>3300.0</Amount>
223
+ <TaxDescription>tax description2</TaxDescription>
224
+ </Tax>
225
+ </Taxes>
226
+ <Expenses>
227
+ <Expense>
228
+ <commons:ExpenseCategory>Trash Fee</commons:ExpenseCategory>
229
+ <commons:ExpenseValue commons:currencyPeriod="Quarterly" commons:isgSecurityClass="Public">2000.0</commons:ExpenseValue>
230
+ </Expense>
231
+ <Expense>
232
+ <commons:ExpenseCategory>Yard Care Fee</commons:ExpenseCategory>
233
+ <commons:ExpenseValue commons:currencyPeriod="Annually" commons:isgSecurityClass="Public">2000.0</commons:ExpenseValue>
234
+ </Expense>
235
+ <Expense>
236
+ <commons:ExpenseCategory>Home Owner Assessments Fee</commons:ExpenseCategory>
237
+ <commons:ExpenseValue commons:currencyPeriod="Annually" commons:isgSecurityClass="Public">1100.0</commons:ExpenseValue>
238
+ </Expense>
239
+ </Expenses>
240
+ <DetailedCharacteristics>
241
+ <Appliances>
242
+ <Appliance>Dishwasher</Appliance>
243
+ <Appliance>Refrigerator</Appliance>
244
+ </Appliances>
245
+ <ArchitectureStyle otherDescription="Ranch">Cape Cod</ArchitectureStyle>
246
+ <HasAttic>true</HasAttic>
247
+ <HasBarbecueArea>true</HasBarbecueArea>
248
+ <HasBasement>true</HasBasement>
249
+ <BuildingUnitCount>1</BuildingUnitCount>
250
+ <IsCableReady>true</IsCableReady>
251
+ <HasCeilingFan>true</HasCeilingFan>
252
+ <CondoFloorNum>1</CondoFloorNum>
253
+ <CoolingSystems>
254
+ <CoolingSystem>Central A/C</CoolingSystem>
255
+ </CoolingSystems>
256
+ <HasDeck>true</HasDeck>
257
+ <HasDisabledAccess>true</HasDisabledAccess>
258
+ <HasDock>true</HasDock>
259
+ <HasDoorman>true</HasDoorman>
260
+ <HasDoublePaneWindows>true</HasDoublePaneWindows>
261
+ <HasElevator>true</HasElevator>
262
+ <ExteriorTypes>
263
+ <ExteriorType>Brick</ExteriorType>
264
+ <ExteriorType>Vinyl Siding</ExteriorType>
265
+ </ExteriorTypes>
266
+ <HasFireplace>true</HasFireplace>
267
+ <FloorCoverings>
268
+ <FloorCovering>Carpet</FloorCovering>
269
+ <FloorCovering>Wood</FloorCovering>
270
+ </FloorCoverings>
271
+ <HasGarden>true</HasGarden>
272
+ <HasGatedEntry>true</HasGatedEntry>
273
+ <HasGreenhouse>true</HasGreenhouse>
274
+ <HeatingFuels>
275
+ <HeatingFuel>Natural Gas</HeatingFuel>
276
+ </HeatingFuels>
277
+ <HeatingSystems>
278
+ <HeatingSystem>Forced Air</HeatingSystem>
279
+ </HeatingSystems>
280
+ <HasHotTubSpa>true</HasHotTubSpa>
281
+ <Intercom>true</Intercom>
282
+ <HasJettedBathTub>true</HasJettedBathTub>
283
+ <HasLawn>true</HasLawn>
284
+ <LegalDescription>Legal description</LegalDescription>
285
+ <HasMotherInLaw>true</HasMotherInLaw>
286
+ <IsNewConstruction>false</IsNewConstruction>
287
+ <NumFloors>2.0</NumFloors>
288
+ <NumParkingSpaces>23</NumParkingSpaces>
289
+ <HasPatio>true</HasPatio>
290
+ <HasPond>true</HasPond>
291
+ <HasPool>true</HasPool>
292
+ <HasPorch>true</HasPorch>
293
+ <RoofTypes>
294
+ <RoofType>Composition Shingle</RoofType>
295
+ </RoofTypes>
296
+ <RoomCount>28</RoomCount>
297
+ <Rooms>
298
+ <Room>Bedroom</Room>
299
+ <Room>Bedroom</Room>
300
+ <Room>Bedroom</Room>
301
+ <Room>Full Bath</Room>
302
+ <Room>Full Bath</Room>
303
+ <Room>Half Bath</Room>
304
+ <Room>Half Bath</Room>
305
+ <Room>Theatre</Room>
306
+ </Rooms>
307
+ <HasRVParking>true</HasRVParking>
308
+ <HasSauna>true</HasSauna>
309
+ <HasSecuritySystem>true</HasSecuritySystem>
310
+ <HasSkylight>true</HasSkylight>
311
+ <HasSportsCourt>true</HasSportsCourt>
312
+ <HasSprinklerSystem>true</HasSprinklerSystem>
313
+ <HasVaultedCeiling>true</HasVaultedCeiling>
314
+ <ViewTypes>
315
+ <ViewType>Mountain</ViewType>
316
+ </ViewTypes>
317
+ <IsWaterfront>true</IsWaterfront>
318
+ <HasWetBar>true</HasWetBar>
319
+ <IsWired>true</IsWired>
320
+ <YearUpdated>2008</YearUpdated>
321
+ </DetailedCharacteristics>
322
+ <ModificationTimestamp commons:isgSecurityClass="Public">2012-03-06T17:14:47-05:00</ModificationTimestamp>
323
+ </Listing>
324
+ <%- end -%>
325
+ </Listings>
@@ -0,0 +1,53 @@
1
+ # Keep XML attributes when converting XML to Hash.
2
+ module ActiveSupport
3
+ class XMLConverter
4
+ private
5
+ def become_content?(value)
6
+ value['type'] == 'file' || (value['__content__'] && (value.keys.size == 1 && value['__content__'].present?))
7
+ end
8
+ end
9
+ end
10
+
11
+ # Allows you to provide a Hash and a number of drilldown elements
12
+ # and return the final value if the whole chain exists, but without
13
+ # throwing an error if the chain has a broken link at some point.
14
+ #
15
+ # Could easily bomb:
16
+ # first_name = some_person_hash['Person]['Name]['FirstName']
17
+ #
18
+ # Doesn't bomb:
19
+ # first_name = some_person_hash.drilldown('Person Name FirstName')
20
+
21
+ Hash.class_eval do
22
+ def drilldown drillees
23
+ if (result = drillees.split(' ').inject(self){|res, el| res[el] ? res[el] : Hash.new })
24
+ result.present? ? (result.unwrap_attribute) : nil
25
+ end
26
+ end
27
+ end
28
+
29
+ Array.class_eval do
30
+ def drilldown drillee
31
+ if (result = drillee.last)
32
+ result.present? ? (result.unwrap_attribute) : nil
33
+ end
34
+ end
35
+ end
36
+
37
+ Object.class_eval do
38
+ def unwrap_attribute
39
+ self.is_a?(Hash) ? (self['__content__'] ? self['__content__'] : self) : self
40
+ end
41
+ end
42
+
43
+
44
+ String.class_eval do
45
+ # Add to_bool method to String.
46
+ def to_bool
47
+ return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
48
+ return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i)
49
+ nil
50
+ end
51
+ end
52
+
53
+
@@ -0,0 +1,43 @@
1
+ module Reso
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ desc "Copy RESO Data Dictionary migration files to your application."
8
+
9
+
10
+ def self.next_migration_number(path)
11
+ Time.now.utc.strftime("%Y%m%d%H%M%S%L")
12
+ end
13
+
14
+ def create_model_file
15
+ template "enumerations.csv", "db/enumerations.csv"
16
+ %w[addresses
17
+ businesses
18
+ enumerations
19
+ expenses
20
+ imports
21
+ listings
22
+ listing_media
23
+ listing_providers
24
+ multiple_listing_services
25
+ open_houses
26
+ offices
27
+ people
28
+ participants
29
+ participant_licenses
30
+ places
31
+ prices
32
+ queued_listings
33
+ rooms
34
+ schools
35
+ taxes
36
+ join_tables].each do |name|
37
+ migration_template "create_#{name}.rb", "db/migrate/create_#{name}.rb"
38
+ end
39
+ end
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,36 @@
1
+ require 'rails/generators/migration'
2
+
3
+ class Reso < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+
6
+ def self.source_root
7
+ @_setup_source_root ||= File.expand_path("../templates", __FILE__)
8
+ end
9
+
10
+ def self.next_migration_number(path)
11
+ Time.now.utc.strftime("%Y%m%d%H%M%S%L")
12
+ end
13
+
14
+ def create_model_file
15
+ migration_template "create_addresses.rb", "db/migrate/create_addresses.rb"
16
+ migration_template "create_businesses.rb", "db/migrate/create_businesses.rb"
17
+ migration_template "create_enumerations.rb", "db/migrate/create_enumerations.rb"
18
+ migration_template "create_expenses.rb", "db/migrate/create_expenses.rb"
19
+ migration_template "create_listing_media.rb", "db/migrate/create_listing_media.rb"
20
+ migration_template "create_participants.rb", "db/migrate/create_participants.rb"
21
+ migration_template "create_participant_licenses.rb", "db/migrate/create_participant_licenses.rb"
22
+ migration_template "create_listing_providers.rb", "db/migrate/create_listing_providers.rb"
23
+ migration_template "create_imports.rb", "db/migrate/create_imports.rb"
24
+ migration_template "create_listings.rb", "db/migrate/create_listings.rb"
25
+ migration_template "create_multiple_listing_services.rb", "db/migrate/create_multiple_listing_services.rb"
26
+ migration_template "create_offices.rb", "db/migrate/create_offices.rb"
27
+ migration_template "create_open_houses.rb", "db/migrate/create_open_houses.rb"
28
+ migration_template "create_places.rb", "db/migrate/create_places.rb"
29
+ migration_template "create_prices.rb", "db/migrate/create_prices.rb"
30
+ migration_template "create_queued_listings.rb", "db/migrate/create_queued_listings.rb"
31
+ migration_template "create_rooms.rb", "db/migrate/create_rooms.rb"
32
+ migration_template "create_schools.rb", "db/migrate/create_schools.rb"
33
+ migration_template "create_taxes.rb", "db/migrate/create_taxes.rb"
34
+ migration_template "create_join_tables.rb", "db/migrate/create_join_tables.rb"
35
+ end
36
+ end
@@ -0,0 +1,33 @@
1
+ class CreateAddresses < ActiveRecord::Migration
2
+ def change
3
+ create_table :addresses, options: 'DEFAULT CHARSET=utf8' do |t|
4
+ t.string :addressable_type
5
+ t.references :addressable
6
+
7
+ t.integer :preference_order, default: 1
8
+ t.integer :address_preference_order, default: 1
9
+ t.string :full_street_address
10
+ t.integer :street_number
11
+ t.string :street_dir_prefix
12
+ t.string :street_name
13
+ t.string :street_suffix
14
+ t.string :street_dir_suffix
15
+ t.string :street_additional_info
16
+ t.integer :box_number
17
+ t.string :unit_number
18
+ t.string :city
19
+ t.string :state_or_province
20
+ t.string :postal_code
21
+ t.string :carrier_route
22
+ t.string :country, default: "US"
23
+ t.references :address_type
24
+
25
+ t.timestamps
26
+ end
27
+ add_index :addresses, :city
28
+ add_index :addresses, :state_or_province
29
+ add_index :addresses, :postal_code
30
+ add_index :addresses, :country
31
+ add_index :addresses, [:addressable_id, :addressable_type]
32
+ end
33
+ end
@@ -0,0 +1,19 @@
1
+ class CreateBusinesses < ActiveRecord::Migration
2
+ def change
3
+ create_table :businesses, options: 'DEFAULT CHARSET=utf8' do |t|
4
+ t.string :name, null: false
5
+ t.string :type, null: false
6
+ t.string :phone
7
+ t.string :fax
8
+ t.string :email
9
+ t.string :website_url
10
+ t.string :logo_url
11
+ t.string :business_additional_information
12
+
13
+ t.timestamps
14
+ end
15
+ add_index :businesses, :name
16
+ add_index :businesses, :type
17
+ add_index :businesses, [:name, :type]
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ class CreateEnumerations < ActiveRecord::Migration
2
+ def change
3
+ create_table :enumerations, options: 'DEFAULT CHARSET=utf8' do |t|
4
+ t.string :name, null: false, index: true, limit: 128
5
+ t.string :type, null: false, index: true
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :enumerations, [:name, :type]
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ class CreateExpenses < ActiveRecord::Migration
2
+ def change
3
+ create_table :expenses, options: 'DEFAULT CHARSET=utf8' do |t|
4
+ t.references :expense_category, index: true
5
+ t.references :currency_period, index: true
6
+ t.decimal :expense_value
7
+ t.references :listing, index: true, null: false
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :expenses, [:expense_category_id, :currency_period_id, :expense_value], name: "index_on_category_and_currency_period_and_value"
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ class CreateImports < ActiveRecord::Migration
2
+ def change
3
+ create_table :imports do |t|
4
+ t.string :name
5
+ t.string :token
6
+ t.references :import_format, index: true
7
+ t.string :repeating_element, default: "Listing"
8
+ t.string :unique_identifier, default: "ListingKey"
9
+ t.string :source_url
10
+ t.string :source_user
11
+ t.string :source_pass
12
+
13
+ t.timestamps null: false
14
+ end
15
+ add_index :imports, :token
16
+ end
17
+ end
@@ -0,0 +1,27 @@
1
+ class CreateJoinTables < ActiveRecord::Migration
2
+ def change
3
+ create_join_table :businesses, :listings
4
+ add_index(:businesses_listings, [:business_id, :listing_id], unique: true)
5
+ add_index(:businesses_listings, :listing_id)
6
+
7
+ create_join_table :enumerations, :listings
8
+ add_index(:enumerations_listings, [:enumeration_id, :listing_id], unique: true)
9
+ add_index(:enumerations_listings, :listing_id)
10
+
11
+ create_join_table :listing_offices, :listings
12
+ add_index(:listing_offices_listings, [:listing_office_id, :listing_id], unique: true, name: "index_listings_offices_listing_id_office_id")
13
+ add_index(:listing_offices_listings, :listing_id)
14
+
15
+ create_join_table :listings, :participants
16
+ add_index(:listings_participants, [:participant_id, :listing_id], unique: true)
17
+ add_index(:listings_participants, :listing_id)
18
+
19
+ create_join_table :listings, :places
20
+ add_index(:listings_places, [:listing_id, :place_id], unique: true)
21
+ add_index(:listings_places, :listing_id)
22
+
23
+ create_join_table :places, :schools
24
+ add_index(:places_schools, [:place_id, :school_id], unique: true)
25
+
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ class CreateListingMedia < ActiveRecord::Migration
2
+ def change
3
+ create_table :listing_media, options: 'DEFAULT CHARSET=latin1' do |t|
4
+ t.integer :media_order_number
5
+ t.string :media_url, null: false, limit: 512
6
+ t.string :media_caption
7
+ t.text :media_description
8
+ t.string :media_modification_timestamp
9
+ t.string :type, null: false
10
+ t.references :listing, index: true, null: false, foreign_key: true
11
+
12
+ t.timestamps
13
+ end
14
+ add_index :listing_media, :media_order_number
15
+ add_index :listing_media, :type
16
+ add_index :listing_media, [:listing_id, :media_order_number]
17
+ add_index :listing_media, [:media_url, :media_modification_timestamp], name: "on_url_and_timestamp"
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ class CreateListingProviders < ActiveRecord::Migration
2
+ def change
3
+ create_table :listing_providers, options: 'DEFAULT CHARSET=utf8' do |t|
4
+ t.string :name, null: false
5
+ t.string :url
6
+ t.references :source_provider_category, null: false, index: true
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :listing_providers, [:name, :source_provider_category_id, :url], name: "index_provider_on_name_and_category_and_url"
11
+ end
12
+ end