class Eaternet::Lives_1_0::Adapter

@abstract Subclass and override {#businesses}, {#inspections},

and optionally {#violations}, {#feed_info}, and {#legends} to
implement a custom Lives 1.0 data source adapter.

Public Instance Methods

businesses() click to toggle source

@example Print the number of restaurants in SomeCity.

some_city = Eaternet::SomeCity.new
puts some_city.businesses.count

@required Yes @return [Enumerable<Business>]

# File lib/eaternet/lives_1_0/adapter.rb, line 13
def businesses
  fail 'Override Adapter#businesses to return an Enumerable of Business'
end
feed_info() click to toggle source

@example Retrieve the name & URL of SomeCity's health agency.

some_city = Eaternet::SomeCity.new
info = some_city.feed_info
puts info.municipality_name
puts info.municipality_url

@required No @return [FeedInfo]

# File lib/eaternet/lives_1_0/adapter.rb, line 46
def feed_info
  fail 'Optionally override this to return a FeedInfo'
end
inspections() click to toggle source

@example Compute the average inspection score for SomeCity.

some_city = Eaternet::SomeCity.new
sum = some_city.inspections
        .map(&:score)
        .reduce(0, :+)
count = some_city.inspections.count

puts "Average inspection score: " + sum / count

@required Yes @return [Enumerable<Inspection>]

# File lib/eaternet/lives_1_0/adapter.rb, line 28
def inspections
  fail 'Override Adapter#inspections to return an Enumerable of Inspection'
end
legends() click to toggle source

@required No @return [Enumerable<Legend>]

# File lib/eaternet/lives_1_0/adapter.rb, line 52
def legends
  fail 'Optionally override this to return an Enumerable of Legend'
end
violations() click to toggle source

@required No @return [Enumerable<Violation>]

# File lib/eaternet/lives_1_0/adapter.rb, line 34
def violations
  fail 'Optionally override this to return an Enumerable of Violation'
end