eventify 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfd7ad797c2f6b778904c736597f27989ba121c13ec8993acfef3f342531534b
4
- data.tar.gz: 43814be3826b24b4c67c6e480c58cf5abd9e1ffea0680bbd35f63c5904d178f0
3
+ metadata.gz: 3fc567ffc7a85fc42db77e86f178614605e508ea5f1acc74c8647857e2c23825
4
+ data.tar.gz: eadc42c6e7b18013650751fbefec5965f5adf02e9ead6c5da97cb50ed9098771
5
5
  SHA512:
6
- metadata.gz: d9ef84b47f8f77ae3d18eff968fb938efab4b4e73e8412a4db209eecf315168e249c775caf873b959f57c8a7ba7c6de3312305536461a5e30cbde5064185e3c4
7
- data.tar.gz: 9ca8da1b182aa553ddfc0d06fdbc2fb07b0ef68d06cf67349d4ba8be5cfb397936024365aa888129d1874ec21ea7d1b3085987cff94c56b4f0cad69f9f9f34a6
6
+ metadata.gz: aa6dfed53318374e4db5570bc3f3ca1c3f6adb14438df98149d1ca2d4fbde30bd5e101cf354ecf2d265ed2bf2205d55850a3f989597fd66a9a3ffa0247d208b7
7
+ data.tar.gz: 328aeb8e2ffc1c7bdc33813adbd7093b7a3c42f9957de1aa6050236d78418e27fe3e4920ea44ca239ab4f53899694ee0eb4be298cabd62271e792f3c9a931235
@@ -1,20 +1,19 @@
1
1
  require "open-uri"
2
- require "nokogiri"
3
2
  require "json"
4
3
  require "time"
5
4
 
6
5
  module Eventify::Provider
7
6
  class Livenation < Base
8
- URL = "https://www.livenation.ee/event/allevents"
7
+ URL = "https://www.livenation.ee/api/search/events?IncludePostponed=true&IncludeCancelled=false&Url=%2Fevent%2Fallevents&PageSize=200&Page=1&CountryIds=68"
9
8
 
10
9
  class << self
11
10
  def fetch
12
- doc = Nokogiri::HTML(URI.open(URL))
13
- doc.search("script[type='application/ld+json']").map do |raw_item|
14
- item = JSON.parse(raw_item.content)
15
- next unless item["name"]
16
- new id: item["url"], title: item["name"], link: item["url"], date: Time.parse(item["startDate"])
17
- end.compact
11
+ json = JSON.parse(URI.open(URL).read)
12
+ entries = json["documents"]
13
+ entries.map do |entry|
14
+ localization = entry["localizations"][0]
15
+ new id: entry["id"], title: localization["name"], link: "https://www.livenation.ee#{localization["url"]}", date: Time.parse(entry["eventDate"])
16
+ end
18
17
  end
19
18
  end
20
19
  end
@@ -1,3 +1,3 @@
1
1
  class Eventify
2
- VERSION = "4.0.1"
2
+ VERSION = "4.0.2"
3
3
  end
@@ -3,21 +3,21 @@ require "spec_helper"
3
3
  describe Eventify::Provider::Livenation do
4
4
  context "#fetch" do
5
5
  it "fetches events" do
6
- stub_request(:get, Eventify::Provider::Livenation::URL).to_return(body: File.read(File.expand_path("../../support/livenation.html", __dir__)))
6
+ stub_request(:get, Eventify::Provider::Livenation::URL).to_return(body: File.read(File.expand_path("../../support/livenation.json", __dir__)))
7
7
 
8
8
  events = Eventify::Provider::Livenation.fetch
9
9
  expect(events).to eq([
10
10
  Eventify::Provider::Livenation.new(
11
- title: "CLANNAD - In A Lifetime Farewell Tour",
12
- link: "https://www.livenation.ee/show/1310067/clannad-in-a-lifetime-farewell-tour/tallinn/2021-03-30/ee",
13
- date: Time.parse("2021-3-30"),
14
- id: "https://www.livenation.ee/show/1310067/clannad-in-a-lifetime-farewell-tour/tallinn/2021-03-30/ee"
11
+ title: "Mogwai",
12
+ link: "https://www.livenation.ee/event/mogwai-tallinn-tickets-edp1569723",
13
+ date: Time.parse("2025-09-08T00:00:00Z"),
14
+ id: "1569723"
15
15
  ),
16
16
  Eventify::Provider::Livenation.new(
17
- title: "JAMES BLUNT - Once Upon A Mind Tour",
18
- link: "https://www.livenation.ee/show/1310003/james-blunt-once-upon-a-mind-tour/tallinn/2021-06-03/ee",
19
- date: Time.parse("2021-6-03"),
20
- id: "https://www.livenation.ee/show/1310003/james-blunt-once-upon-a-mind-tour/tallinn/2021-06-03/ee"
17
+ title: "Smash Into Pieces",
18
+ link: "https://www.livenation.ee/event/smash-into-pieces-tallinn-tickets-edp1602333",
19
+ date: Time.parse("2025-10-06T00:00:00Z"),
20
+ id: "1602333"
21
21
  )
22
22
  ])
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventify
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarmo Pertman
@@ -155,7 +155,6 @@ files:
155
155
  - spec/eventify_spec.rb
156
156
  - spec/spec_helper.rb
157
157
  - spec/support/apollo_kino.html
158
- - spec/support/livenation.html
159
158
  - spec/support/piletilevi-page1.json
160
159
  - spec/support/piletilevi-page2.json
161
160
  homepage: https://github.com/jarmo/eventify
@@ -192,6 +191,5 @@ test_files:
192
191
  - spec/eventify_spec.rb
193
192
  - spec/spec_helper.rb
194
193
  - spec/support/apollo_kino.html
195
- - spec/support/livenation.html
196
194
  - spec/support/piletilevi-page1.json
197
195
  - spec/support/piletilevi-page2.json