Class: Eventify::Provider::ApolloKino

Inherits:
Base
  • Object
show all
Defined in:
lib/eventify/provider/apollo_kino.rb

Constant Summary collapse

URL =
"https://www.apollokino.ee/eng/movies?3064-actionType=1"

Constants inherited from Base

Base::MissingAttributeError

Instance Attribute Summary

Attributes inherited from Base

#date, #id, #link, #title

Class Method Summary collapse

Methods inherited from Base

#<=>, #==, #exists?, #hash, #initialize, #provider, #save

Constructor Details

This class inherits a constructor from Eventify::Provider::Base

Class Method Details

.fetchObject



10
11
12
13
14
15
16
17
18
# File 'lib/eventify/provider/apollo_kino.rb', line 10

def fetch
  doc = Nokogiri::HTML(URI.open(URL))
  doc.search(".schedule__item").map do |item|
    title_node = item.at(".movie-card__title a")
    url = title_node["href"]
    date = Time.strptime(item.at(".movie-card__label").content.gsub(/In Cinemas /, ""), "%m/%d/%Y")
    new id: url, title: title_node.content, link: url, date: date
  end
end