Class: Eventify::Provider::Piletilevi

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

Constant Summary collapse

URL =
URI.parse("https://www.piletilevi.ee/api/v1/events?language=et&page=:PAGE:&pageSize=36&sortBy=date&sortOrder=ASC")
EVENT_BASE_URL =
URI.parse("https://www.piletilevi.ee/piletid/:ID:/:SLUG:")

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
# File 'lib/eventify/provider/piletilevi.rb', line 10

def fetch
  first_page_json = fetch_page(1)
  total_pages = first_page_json["totalPages"]
  result = events(first_page_json) + (2..total_pages).flat_map { |page_number| events(fetch_page(page_number)) }
  result
end