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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce786f05aad870991f2dd8d6177cba1985fe1556
4
- data.tar.gz: d5234648edee0fe2d19d5e5facf838026db10dea
3
+ metadata.gz: 6c4e7768c1345003617a43651a279895680427e5
4
+ data.tar.gz: 0610ee8faa3c460fdb532403bee2aba181f6c456
5
5
  SHA512:
6
- metadata.gz: 0d9548f8f56f3d33b81086fe48a3fe60ced41df0178a413cc94e9223eb99a1443275a4300320d2d5bfac1ad02d5657354c2a14c2de16ceab1701dfc97514fe4c
7
- data.tar.gz: bd82e426e22a74f3f5f25466fd5e20e81a9d2c983b1aaaac1fa32e7c37d2491dec9e2ace432aab81ea947597d4608542ff6f8cbac616a90a418ace80c23fec26
6
+ metadata.gz: aca898fefac2e693151c6359b59d2964252407d83466d569931fd12667abfbf8f822ed6d8c7ec1dfc3a65f73bd96f952bfe7dba8b439ce03265e2c78b85f0f8d
7
+ data.tar.gz: 4a6a666002c0a80157bd408e679517839f02e9f0f5cbc6b89eb75ddf17107900c484d3662186d978fa7ed41bf6241637b964bb91cd1e54f36bc0e9f2e147b71a
@@ -112,120 +112,118 @@ module Mapper
112
112
  year_updated
113
113
  )
114
114
 
115
- def self.fetch_enumerations class_name
116
- Rails.cache.fetch(class_name, expires_in: 1.hours) do
117
- enums = {}
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
- fetch_enumerations 'AddressType'
121
+ def self.address_types item_name
122
+ fetch_enumeration 'AddressType', item_name
125
123
  end
126
124
 
127
- def self.appliances
128
- fetch_enumerations 'Appliance'
125
+ def self.appliances item_name
126
+ fetch_enumeration 'Appliance', item_name
129
127
  end
130
128
 
131
- def self.architecture_styles
132
- fetch_enumerations 'ArchitectureStyle'
129
+ def self.architecture_styles item_name
130
+ fetch_enumeration 'ArchitectureStyle', item_name
133
131
  end
134
132
 
135
- def self.area_units
136
- fetch_enumerations 'AreaUnit'
133
+ def self.area_units item_name
134
+ fetch_enumeration 'AreaUnit', item_name
137
135
  end
138
136
 
139
- def self.cooling_systems
140
- fetch_enumerations 'CoolingSystem'
137
+ def self.cooling_systems item_name
138
+ fetch_enumeration 'CoolingSystem', item_name
141
139
  end
142
140
 
143
- def self.currency_periods
144
- fetch_enumerations 'CurrencyPeriod'
141
+ def self.currency_periods item_name
142
+ fetch_enumeration 'CurrencyPeriod', item_name
145
143
  end
146
144
 
147
- def self.expense_categories
148
- fetch_enumerations 'ExpenseCategory'
145
+ def self.expense_categories item_name
146
+ fetch_enumeration 'ExpenseCategory', item_name
149
147
  end
150
148
 
151
- def self.exterior_types
152
- fetch_enumerations 'ExteriorType'
149
+ def self.exterior_types item_name
150
+ fetch_enumeration 'ExteriorType', item_name
153
151
  end
154
152
 
155
- def self.floor_coverings
156
- fetch_enumerations 'FloorCovering'
153
+ def self.floor_coverings item_name
154
+ fetch_enumeration 'FloorCovering', item_name
157
155
  end
158
156
 
159
- def self.foreclosure_statuses
160
- fetch_enumerations 'ForeclosureStatus'
157
+ def self.foreclosure_statuses item_name
158
+ fetch_enumeration 'ForeclosureStatus', item_name
161
159
  end
162
160
 
163
- def self.gender
164
- fetch_enumerations 'Gender'
161
+ def self.gender item_name
162
+ fetch_enumeration 'Gender', item_name
165
163
  end
166
164
 
167
- def self.heating_fuels
168
- fetch_enumerations 'HeatingFuel'
165
+ def self.heating_fuels item_name
166
+ fetch_enumeration 'HeatingFuel', item_name
169
167
  end
170
168
 
171
- def self.heating_systems
172
- fetch_enumerations 'HeatingSystem'
169
+ def self.heating_systems item_name
170
+ fetch_enumeration 'HeatingSystem', item_name
173
171
  end
174
172
 
175
- def self.home_features
176
- fetch_enumerations 'HomeFeature'
173
+ def self.home_features item_name
174
+ fetch_enumeration 'HomeFeature', item_name
177
175
  end
178
176
 
179
- def self.import_formats
180
- fetch_enumerations 'ImportFormat'
177
+ def self.import_formats item_name
178
+ fetch_enumeration 'ImportFormat', item_name
181
179
  end
182
180
 
183
- def self.license_categories
184
- fetch_enumerations 'LicenseCategory'
181
+ def self.license_categories item_name
182
+ fetch_enumeration 'LicenseCategory', item_name
185
183
  end
186
184
 
187
- def self.listing_categories
188
- fetch_enumerations 'ListingCategory'
185
+ def self.listing_categories item_name
186
+ fetch_enumeration 'ListingCategory', item_name
189
187
  end
190
188
 
191
- def self.listing_statuses
192
- fetch_enumerations 'ListingStatus'
189
+ def self.listing_statuses item_name
190
+ fetch_enumeration 'ListingStatus', item_name
193
191
  end
194
192
 
195
- def self.parkings
196
- fetch_enumerations 'Parking'
193
+ def self.parkings item_name
194
+ fetch_enumeration 'Parking', item_name
197
195
  end
198
196
 
199
- def self.participant_roles
200
- fetch_enumerations 'ParticipantRole'
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
- fetch_enumerations 'PropertySubType'
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
- fetch_enumerations 'PropertyType'
205
+ def self.property_types item_name
206
+ fetch_enumeration 'PropertyType', item_name
209
207
  end
210
208
 
211
- def self.roof_types
212
- fetch_enumerations 'RoofType'
209
+ def self.roof_types item_name
210
+ fetch_enumeration 'RoofType', item_name
213
211
  end
214
212
 
215
- def self.room_categories
216
- fetch_enumerations 'RoomCategory'
213
+ def self.room_categories item_name
214
+ fetch_enumeration 'RoomCategory', item_name
217
215
  end
218
216
 
219
- def self.school_categories
220
- fetch_enumerations 'SchoolCategory'
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
- fetch_enumerations 'SourceProviderCategory'
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
- fetch_enumerations 'ViewType'
225
+ def self.view_types item_name
226
+ fetch_enumeration 'ViewType', item_name
229
227
  end
230
228
 
231
229
  end
@@ -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[result] : nil
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[item['ExpenseCategory']],
112
- currency_period: Mapper::expense_categories[item['ExpenseValue']['currencyPeriod']],
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[result] : nil
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[result] : nil
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[get_value(queued_listing, %w(ProviderCategory))]
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[result] : nil
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[item['Role']],
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[result] : nil
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[result] : nil
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[room_category])}
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
@@ -1,3 +1,3 @@
1
1
  module Reso
2
- VERSION = "0.1.0.2"
2
+ VERSION = "0.1.0.3"
3
3
  end
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.2
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-19 00:00:00.000000000 Z
11
+ date: 2015-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake