Class: Eventify::Provider::Livenation

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

Constant Summary collapse

URL =
"https://www.livenation.ee/event/allevents"

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



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

def fetch
  doc = Nokogiri::HTML(URI.open(URL))
  doc.search("script[type='application/ld+json']").map do |raw_item|
    item = JSON.parse(raw_item.content)
    next unless item["name"]
    new id: item["url"], title: item["name"], link: item["url"], date: Time.parse(item["startDate"])
  end.compact
end