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/ajaxCaller/method:getConcertsListInfo/id:1089/type:catalog_category/order:date,asc")

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



9
10
11
12
13
14
15
# File 'lib/eventify/provider/piletilevi.rb', line 9

def fetch
  first_page_json = fetch_page(1)
  list_info = first_page_json["responseData"]["listInfo"]
  total_pages = list_info["total"] / list_info["pageSize"] + 1
  result = events(first_page_json) + (2..total_pages).flat_map { |page_number| events(fetch_page(page_number)) }
  result
end