Class: Eaternet::Agencies::Lives2

Inherits:
Lives_1_0::Adapter show all
Includes:
Lives_1_0::CsvParser, Loggable
Defined in:
lib/eaternet/agencies/lives2.rb

Instance Method Summary collapse

Methods included from Lives_1_0::CsvParser

#convert, #csv_map, #csv_rows, #map_csv, #try_to_create, #zip_dir

Methods included from Loggable

#logger

Methods inherited from Lives_1_0::Adapter

#legends

Constructor Details

#initialize(feed_url:, municipality_name:, municipality_url:, contact_email:) ⇒ Lives2

Returns a new instance of Lives2.



15
16
17
18
19
20
# File 'lib/eaternet/agencies/lives2.rb', line 15

def initialize(feed_url:, municipality_name:, municipality_url:, contact_email:)
  @feed_url = feed_url
  @municipality_name = municipality_name
  @municipality_url = municipality_url
  @contact_email = contact_email
end

Instance Method Details

#adapter_nameObject



44
45
46
# File 'lib/eaternet/agencies/lives2.rb', line 44

def adapter_name
  @municipality_name
end

#businessesObject



22
23
24
# File 'lib/eaternet/agencies/lives2.rb', line 22

def businesses
  convert csv: 'businesses.csv', to_type: :business
end

#feed_infoObject



34
35
36
37
38
39
40
41
42
# File 'lib/eaternet/agencies/lives2.rb', line 34

def feed_info
  Eaternet::Lives_1_0::FeedInfo.new do |fi|
    fi.feed_date =         Date.today
    fi.feed_version =      '2.0'
    fi.municipality_name = @municipality_name
    fi.municipality_url =  @municipality_url
    fi.contact_email =     @contact_email
  end
end

#inspectionsObject



26
27
28
# File 'lib/eaternet/agencies/lives2.rb', line 26

def inspections
  convert csv: 'inspections.csv', to_type: :inspection
end

#violationsObject



30
31
32
# File 'lib/eaternet/agencies/lives2.rb', line 30

def violations
  convert csv: 'violations.csv', to_type: :violation
end

#zip_file_urlObject



48
49
50
# File 'lib/eaternet/agencies/lives2.rb', line 48

def zip_file_url
  @feed_url
end