reso 0.1.0.2 → 0.1.0.3
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.
- checksums.yaml +4 -4
- data/lib/mapper.rb +57 -59
- data/lib/mapper/reso.rb +11 -11
- data/lib/reso/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c4e7768c1345003617a43651a279895680427e5
|
4
|
+
data.tar.gz: 0610ee8faa3c460fdb532403bee2aba181f6c456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aca898fefac2e693151c6359b59d2964252407d83466d569931fd12667abfbf8f822ed6d8c7ec1dfc3a65f73bd96f952bfe7dba8b439ce03265e2c78b85f0f8d
|
7
|
+
data.tar.gz: 4a6a666002c0a80157bd408e679517839f02e9f0f5cbc6b89eb75ddf17107900c484d3662186d978fa7ed41bf6241637b964bb91cd1e54f36bc0e9f2e147b71a
|
data/lib/mapper.rb
CHANGED
@@ -112,120 +112,118 @@ module Mapper
|
|
112
112
|
year_updated
|
113
113
|
)
|
114
114
|
|
115
|
-
def self.
|
116
|
-
Rails.cache.fetch(class_name, expires_in: 1.hours) do
|
117
|
-
|
118
|
-
class_name.constantize.all.map{|item| enums[item.name] = item}
|
119
|
-
enums
|
115
|
+
def self.fetch_enumeration class_name, item_name
|
116
|
+
Rails.cache.fetch([class_name, item_name], expires_in: 1.hours) do
|
117
|
+
class_name.constantize.find_by(name: item_name)
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
123
|
-
def self.address_types
|
124
|
-
|
121
|
+
def self.address_types item_name
|
122
|
+
fetch_enumeration 'AddressType', item_name
|
125
123
|
end
|
126
124
|
|
127
|
-
def self.appliances
|
128
|
-
|
125
|
+
def self.appliances item_name
|
126
|
+
fetch_enumeration 'Appliance', item_name
|
129
127
|
end
|
130
128
|
|
131
|
-
def self.architecture_styles
|
132
|
-
|
129
|
+
def self.architecture_styles item_name
|
130
|
+
fetch_enumeration 'ArchitectureStyle', item_name
|
133
131
|
end
|
134
132
|
|
135
|
-
def self.area_units
|
136
|
-
|
133
|
+
def self.area_units item_name
|
134
|
+
fetch_enumeration 'AreaUnit', item_name
|
137
135
|
end
|
138
136
|
|
139
|
-
def self.cooling_systems
|
140
|
-
|
137
|
+
def self.cooling_systems item_name
|
138
|
+
fetch_enumeration 'CoolingSystem', item_name
|
141
139
|
end
|
142
140
|
|
143
|
-
def self.currency_periods
|
144
|
-
|
141
|
+
def self.currency_periods item_name
|
142
|
+
fetch_enumeration 'CurrencyPeriod', item_name
|
145
143
|
end
|
146
144
|
|
147
|
-
def self.expense_categories
|
148
|
-
|
145
|
+
def self.expense_categories item_name
|
146
|
+
fetch_enumeration 'ExpenseCategory', item_name
|
149
147
|
end
|
150
148
|
|
151
|
-
def self.exterior_types
|
152
|
-
|
149
|
+
def self.exterior_types item_name
|
150
|
+
fetch_enumeration 'ExteriorType', item_name
|
153
151
|
end
|
154
152
|
|
155
|
-
def self.floor_coverings
|
156
|
-
|
153
|
+
def self.floor_coverings item_name
|
154
|
+
fetch_enumeration 'FloorCovering', item_name
|
157
155
|
end
|
158
156
|
|
159
|
-
def self.foreclosure_statuses
|
160
|
-
|
157
|
+
def self.foreclosure_statuses item_name
|
158
|
+
fetch_enumeration 'ForeclosureStatus', item_name
|
161
159
|
end
|
162
160
|
|
163
|
-
def self.gender
|
164
|
-
|
161
|
+
def self.gender item_name
|
162
|
+
fetch_enumeration 'Gender', item_name
|
165
163
|
end
|
166
164
|
|
167
|
-
def self.heating_fuels
|
168
|
-
|
165
|
+
def self.heating_fuels item_name
|
166
|
+
fetch_enumeration 'HeatingFuel', item_name
|
169
167
|
end
|
170
168
|
|
171
|
-
def self.heating_systems
|
172
|
-
|
169
|
+
def self.heating_systems item_name
|
170
|
+
fetch_enumeration 'HeatingSystem', item_name
|
173
171
|
end
|
174
172
|
|
175
|
-
def self.home_features
|
176
|
-
|
173
|
+
def self.home_features item_name
|
174
|
+
fetch_enumeration 'HomeFeature', item_name
|
177
175
|
end
|
178
176
|
|
179
|
-
def self.import_formats
|
180
|
-
|
177
|
+
def self.import_formats item_name
|
178
|
+
fetch_enumeration 'ImportFormat', item_name
|
181
179
|
end
|
182
180
|
|
183
|
-
def self.license_categories
|
184
|
-
|
181
|
+
def self.license_categories item_name
|
182
|
+
fetch_enumeration 'LicenseCategory', item_name
|
185
183
|
end
|
186
184
|
|
187
|
-
def self.listing_categories
|
188
|
-
|
185
|
+
def self.listing_categories item_name
|
186
|
+
fetch_enumeration 'ListingCategory', item_name
|
189
187
|
end
|
190
188
|
|
191
|
-
def self.listing_statuses
|
192
|
-
|
189
|
+
def self.listing_statuses item_name
|
190
|
+
fetch_enumeration 'ListingStatus', item_name
|
193
191
|
end
|
194
192
|
|
195
|
-
def self.parkings
|
196
|
-
|
193
|
+
def self.parkings item_name
|
194
|
+
fetch_enumeration 'Parking', item_name
|
197
195
|
end
|
198
196
|
|
199
|
-
def self.participant_roles
|
200
|
-
|
197
|
+
def self.participant_roles item_name
|
198
|
+
fetch_enumeration 'ParticipantRole', item_name
|
201
199
|
end
|
202
200
|
|
203
|
-
def self.property_sub_types
|
204
|
-
|
201
|
+
def self.property_sub_types item_name
|
202
|
+
fetch_enumeration 'PropertySubType', item_name
|
205
203
|
end
|
206
204
|
|
207
|
-
def self.property_types
|
208
|
-
|
205
|
+
def self.property_types item_name
|
206
|
+
fetch_enumeration 'PropertyType', item_name
|
209
207
|
end
|
210
208
|
|
211
|
-
def self.roof_types
|
212
|
-
|
209
|
+
def self.roof_types item_name
|
210
|
+
fetch_enumeration 'RoofType', item_name
|
213
211
|
end
|
214
212
|
|
215
|
-
def self.room_categories
|
216
|
-
|
213
|
+
def self.room_categories item_name
|
214
|
+
fetch_enumeration 'RoomCategory', item_name
|
217
215
|
end
|
218
216
|
|
219
|
-
def self.school_categories
|
220
|
-
|
217
|
+
def self.school_categories item_name
|
218
|
+
fetch_enumeration 'SchoolCategory', item_name
|
221
219
|
end
|
222
220
|
|
223
|
-
def self.source_provider_categories
|
224
|
-
|
221
|
+
def self.source_provider_categories item_name
|
222
|
+
fetch_enumeration 'SourceProviderCategory', item_name
|
225
223
|
end
|
226
224
|
|
227
|
-
def self.view_types
|
228
|
-
|
225
|
+
def self.view_types item_name
|
226
|
+
fetch_enumeration 'ViewType', item_name
|
229
227
|
end
|
230
228
|
|
231
229
|
end
|
data/lib/mapper/reso.rb
CHANGED
@@ -38,7 +38,7 @@ module Mapper
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.architecture_style queued_listing, listing
|
41
|
-
(result = get_value(queued_listing, %w(DetailedCharacteristics ArchitectureStyle))) ? Mapper::architecture_styles
|
41
|
+
(result = get_value(queued_listing, %w(DetailedCharacteristics ArchitectureStyle))) ? Mapper::architecture_styles(result) : nil
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.architecture_style_description queued_listing, listing
|
@@ -108,8 +108,8 @@ module Mapper
|
|
108
108
|
def self.expenses queued_listing, listing
|
109
109
|
if (result = get_repeaters(queued_listing, %w(Expenses Expense)))
|
110
110
|
result.map{|item| listing.expenses.find_or_initialize_by(
|
111
|
-
expense_category: Mapper::expense_categories
|
112
|
-
currency_period: Mapper::expense_categories
|
111
|
+
expense_category: Mapper::expense_categories(item['ExpenseCategory']),
|
112
|
+
currency_period: Mapper::expense_categories(item['ExpenseValue']['currencyPeriod']),
|
113
113
|
expense_value: item['ExpenseValue'].unwrap_attribute
|
114
114
|
)}
|
115
115
|
end
|
@@ -124,7 +124,7 @@ module Mapper
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def self.foreclosure_status queued_listing, listing
|
127
|
-
(result = get_value(queued_listing, %w(ForeclosureStatus))) ? Mapper::foreclosure_statuses
|
127
|
+
(result = get_value(queued_listing, %w(ForeclosureStatus))) ? Mapper::foreclosure_statuses(result) : nil
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.franchise queued_listing, listing
|
@@ -312,7 +312,7 @@ module Mapper
|
|
312
312
|
end
|
313
313
|
|
314
314
|
def self.listing_category queued_listing, listing
|
315
|
-
(result = get_value(queued_listing, %w(ListingCategory))) ? Mapper::listing_categories
|
315
|
+
(result = get_value(queued_listing, %w(ListingCategory))) ? Mapper::listing_categories(result) : nil
|
316
316
|
end
|
317
317
|
|
318
318
|
def self.listing_date queued_listing, listing
|
@@ -343,13 +343,13 @@ module Mapper
|
|
343
343
|
result = ListingProvider.find_or_initialize_by(
|
344
344
|
name: get_value(queued_listing, %w(ProviderName)),
|
345
345
|
url: get_value(queued_listing, %w(ProviderURL)),
|
346
|
-
source_provider_category: Mapper::source_provider_categories
|
346
|
+
source_provider_category: Mapper::source_provider_categories(get_value(queued_listing, %w(ProviderCategory)))
|
347
347
|
)
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
351
351
|
def self.listing_status queued_listing, listing
|
352
|
-
(result = get_value(queued_listing, %w(ListingStatus))) ? Mapper::listing_statuses
|
352
|
+
(result = get_value(queued_listing, %w(ListingStatus))) ? Mapper::listing_statuses(result) : nil
|
353
353
|
end
|
354
354
|
|
355
355
|
def self.listing_title queued_listing, listing
|
@@ -482,7 +482,7 @@ module Mapper
|
|
482
482
|
participant.assign_attributes({
|
483
483
|
participant_key: item['ParticipantKey'],
|
484
484
|
participant_identifier: item['ParticipantId'],
|
485
|
-
participant_role: Mapper::participant_roles
|
485
|
+
participant_role: Mapper::participant_roles(item['Role']),
|
486
486
|
primary_contact_phone: item['PrimaryContactPhone'],
|
487
487
|
office_phone: item['OfficePhone'],
|
488
488
|
fax: item['Fax'],
|
@@ -502,7 +502,7 @@ module Mapper
|
|
502
502
|
end
|
503
503
|
|
504
504
|
def self.property_sub_type queued_listing, listing
|
505
|
-
(result = get_value(queued_listing, %w(PropertySubType))) ? Mapper::property_sub_types
|
505
|
+
(result = get_value(queued_listing, %w(PropertySubType))) ? Mapper::property_sub_types(result) : nil
|
506
506
|
end
|
507
507
|
|
508
508
|
def self.property_sub_type_description queued_listing, listing
|
@@ -510,7 +510,7 @@ module Mapper
|
|
510
510
|
end
|
511
511
|
|
512
512
|
def self.property_type queued_listing, listing
|
513
|
-
(result = get_value(queued_listing, %w(PropertyType))) ? Mapper::property_types
|
513
|
+
(result = get_value(queued_listing, %w(PropertyType))) ? Mapper::property_types(result) : nil
|
514
514
|
end
|
515
515
|
|
516
516
|
def self.property_type_description queued_listing, listing
|
@@ -527,7 +527,7 @@ module Mapper
|
|
527
527
|
|
528
528
|
def self.rooms queued_listing, listing
|
529
529
|
if (result = get_value(queued_listing, %w(DetailedCharacteristics Rooms Room)))
|
530
|
-
rooms = Array(result).map{|room_category| Room.new(listing: listing, room_category: Mapper::room_categories
|
530
|
+
rooms = Array(result).map{|room_category| Room.new(listing: listing, room_category: Mapper::room_categories(room_category))}
|
531
531
|
end
|
532
532
|
rooms ? rooms : []
|
533
533
|
end
|
data/lib/reso/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Edlund
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|