Class: UkParliament::HouseMembersSourceFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/uk_parliament/house_members_source_factory.rb

Overview

Factory taking responsibility for instantiating correct data source class for a given data source ID/house ID pair.

Class Method Summary collapse

Class Method Details

.init_data_source(data_source_id, house_id) ⇒ Object

Create correct type of class for the IDs passed in.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/uk_parliament/house_members_source_factory.rb', line 6

def self.init_data_source(data_source_id, house_id)
  source = nil

  if data_source_id == DATA_SOURCE_FILE
    source = FileHouseMembers.new(house_id)
  elsif data_source_id == DATA_SOURCE_HTTP
    source = HttpHouseMembers.new(house_id)
  end

  source
end