Module: RubbishCollection
- Defined in:
- lib/rubbish_collection.rb,
lib/rubbish_collection/version.rb,
lib/rubbish_collection/rushmoor.rb,
lib/rubbish_collection/redbridge.rb,
lib/rubbish_collection/southwark.rb
Defined Under Namespace
Classes: Collection, CollectionTime, Collections, RedbridgeAdapter, Resolution, RushmoorAdapter, Schedule, SouthwarkAdapter, UnknownAdapter
Constant Summary
collapse
- DOMESTIC_RUBBISH =
'Domestic Rubbish'.freeze
- DOMESTIC_RECYCLING =
'Domestic Recycling'.freeze
- COMMUNAL_RECYCLING =
'Communal Recycling'.freeze
- VERSION =
"0.0.4"
Class Method Summary
collapse
Class Method Details
.adapter_for(local_authority) ⇒ Object
219
220
221
222
223
|
# File 'lib/rubbish_collection.rb', line 219
def self.adapter_for local_authority
adapter = adapters[local_authority.map_it_id]
adapter.load if adapter.respond_to? :load
adapter.new local_authority
end
|
.adapters ⇒ Object
215
216
217
|
# File 'lib/rubbish_collection.rb', line 215
def self.adapters
@@adapters ||= Hash.new UnknownAdapter
end
|
.register_adapter(map_it_id, adapter) ⇒ Object
225
226
227
|
# File 'lib/rubbish_collection.rb', line 225
def self.register_adapter map_it_id, adapter
adapters[map_it_id] = adapter
end
|
.times_at_address(address) ⇒ Object
203
204
205
206
207
208
209
210
211
212
213
|
# File 'lib/rubbish_collection.rb', line 203
def self.times_at_address address
pc = address.postcode
local_authority = LocalAuthority::LocalAuthority.find_by_postcode pc
times = Collections.new
return times if local_authority.nil?
adaptor = adapter_for local_authority
adaptor.collection_times_at(address).each do |t|
times << t
end
times
end
|