class Eventify

Constants

VERSION

Attributes

configuration[R]
providers[W]

Public Class Methods

new(configuration=Eventify::Configuration.new) click to toggle source
# File lib/eventify.rb, line 13
def initialize(configuration=Eventify::Configuration.new)
  @configuration = configuration
end

Public Instance Methods

all_events() click to toggle source
# File lib/eventify.rb, line 17
def all_events
  @all_events ||= providers.flat_map(&:fetch).uniq
end
new_events() click to toggle source
# File lib/eventify.rb, line 21
def new_events
  @new_events ||= all_events.reject(&:exists?)
end
process_new_events() click to toggle source
# File lib/eventify.rb, line 25
def process_new_events
  all_new_events = new_events
  return if all_new_events.empty?

  Eventify::Mail.deliver all_new_events, @configuration
  all_new_events.each(&:save)
end
providers() click to toggle source
# File lib/eventify.rb, line 35
def providers
  @providers ||= [
    Eventify::Provider::Piletilevi,
    Eventify::Provider::Livenation,
    Eventify::Provider::ApolloKino
  ]
end