Class: Eventify
- Inherits:
-
Object
show all
- Defined in:
- lib/eventify.rb,
lib/eventify/version.rb,
lib/eventify/provider/base.rb
Defined Under Namespace
Modules: Provider
Classes: Configuration, Database, Mail
Constant Summary
collapse
- VERSION =
"1.3.0"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(configuration = Eventify::Configuration.new) ⇒ Eventify
13
14
15
|
# File 'lib/eventify.rb', line 13
def initialize(configuration=Eventify::Configuration.new)
@configuration = configuration
end
|
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
11
12
13
|
# File 'lib/eventify.rb', line 11
def configuration
@configuration
end
|
#providers ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/eventify.rb', line 35
def providers
@providers ||= [
Eventify::Provider::Piletilevi,
Eventify::Provider::FBI,
Eventify::Provider::SolarisKino
]
end
|
Instance Method Details
#all_events ⇒ Object
17
18
19
|
# File 'lib/eventify.rb', line 17
def all_events
@all_events ||= providers.flat_map(&:fetch).uniq
end
|
#new_events ⇒ Object
21
22
23
|
# File 'lib/eventify.rb', line 21
def new_events
@new_events ||= all_events.reject(&:exists?)
end
|
#process_new_events ⇒ Object
25
26
27
28
29
30
31
|
# 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
|