eventify 1.5.0 → 2.0.0

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
- SHA1:
3
- metadata.gz: b7255f0490e6b1c757ac200dcd49feb91b62e151
4
- data.tar.gz: aecc08585ba979ac73061b33ded2803299339a79
2
+ SHA256:
3
+ metadata.gz: e069144a441b2ca98eb2c985c7f4ba4ce06c44723c8821937185d566eab225a7
4
+ data.tar.gz: 2bd32d243eaf11b5080295606715d18b2ed9a35576cfa1377a4ad1c571eb879f
5
5
  SHA512:
6
- metadata.gz: 4fa266923be0af3cf05825bd61504426fc91fa798d13300c484e81c7139264375d93f0e5399095f691b1820583d31e70c0d17120df6d28f4c69f6578ea92a682
7
- data.tar.gz: 520c00fb76ea8ab7bec5a4638ff136f9899b68178ef3dcc82f4d9e747b84feb6630ebad2000fee1a7cab11df428a63307a9a5a17b1702b69a915ce1d9bbadf97
6
+ metadata.gz: e81cef2358780927c2d9ebce6668641385c54d8c1a526b75a42649901bd19709943eed031a07f5c5ac0575f48a639a6dc8275153d42d1957539f07951b60c40d
7
+ data.tar.gz: 8085db677f434f04fa5fd793a2c74b9e7d095d20a36660e54b55ea3f541774687e85c1b7bb75ce8858061aba72db9adfdbb75dac406b454bf95cdbf744ac2457
data/.gitignore CHANGED
File without changes
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.5.5
@@ -1,6 +1,5 @@
1
1
  rvm:
2
2
  - 2.3.1
3
- - 2.2.5
4
3
  - ruby-head
5
4
  notifications:
6
5
  recipients:
data/Gemfile CHANGED
@@ -1,14 +1,14 @@
1
- source "https://rubygems.org"
2
-
3
- group :development do
4
- gem "guard"
5
- gem "guard-rspec"
6
- gem "guard-bundler"
7
- gem "wdm", platform: :mingw
8
- gem "win32console", platform: :mingw
9
- gem "ruby_gntp"
10
- end
11
-
12
- gemspec
13
-
14
- gem "coveralls", require: false
1
+ source "https://rubygems.org"
2
+
3
+ group :development do
4
+ gem "guard"
5
+ gem "guard-rspec"
6
+ gem "guard-bundler"
7
+ gem "wdm", platform: :mingw
8
+ gem "win32console", platform: :mingw
9
+ gem "ruby_gntp"
10
+ end
11
+
12
+ gemspec
13
+
14
+ gem "coveralls", require: false
data/Guardfile CHANGED
File without changes
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Jarmo Pertman
1
+ Copyright (c) Jarmo Pertman
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -38,9 +38,9 @@ providers/organizers in an aggregate way.
38
38
 
39
39
  The following providers are currently supported:
40
40
 
41
- * [FBI](http://fbi.ee)
41
+ * [Livenation](https://livenation.ee)
42
42
  * [Piletilevi](http://www.piletilevi.ee/)
43
- * [Solaris Kino](http://solariskino.ee/)
43
+ * [Apollo Kino](https://www.apollokino.ee/)
44
44
 
45
45
  ## Adding New Providers
46
46
 
data/Rakefile CHANGED
File without changes
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "simple-rss"
22
- spec.add_dependency "nokogiri"
22
+ spec.add_dependency "nokogiri", "~> 1.11.0"
23
23
  spec.add_dependency "sqlite3"
24
- spec.add_dependency "mail"
24
+ spec.add_dependency "mail", "~> 2.7.0.rc1"
25
25
  spec.add_dependency "faraday"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -1,9 +1,9 @@
1
1
  require File.expand_path("eventify/version", __dir__)
2
2
  require File.expand_path("eventify/configuration", __dir__)
3
3
  require File.expand_path("eventify/provider/base", __dir__)
4
- require File.expand_path("eventify/provider/fbi", __dir__)
4
+ require File.expand_path("eventify/provider/livenation", __dir__)
5
5
  require File.expand_path("eventify/provider/piletilevi", __dir__)
6
- require File.expand_path("eventify/provider/solaris_kino", __dir__)
6
+ require File.expand_path("eventify/provider/apollo_kino", __dir__)
7
7
  require File.expand_path("eventify/database", __dir__)
8
8
  require File.expand_path("eventify/mail", __dir__)
9
9
 
@@ -35,8 +35,8 @@ class Eventify
35
35
  def providers
36
36
  @providers ||= [
37
37
  Eventify::Provider::Piletilevi,
38
- Eventify::Provider::FBI,
39
- Eventify::Provider::SolarisKino
38
+ Eventify::Provider::Livenation,
39
+ Eventify::Provider::ApolloKino
40
40
  ]
41
41
  end
42
42
  end
File without changes
File without changes
File without changes
@@ -0,0 +1,21 @@
1
+ require "open-uri"
2
+ require "nokogiri"
3
+ require "time"
4
+
5
+ module Eventify::Provider
6
+ class ApolloKino < Base
7
+ URL = "https://www.apollokino.ee/"
8
+
9
+ class << self
10
+ def fetch
11
+ doc = Nokogiri::HTML(open(URI.join(URL, "eng/soon"), {"Accept-Encoding" => "gzip,deflate"}))
12
+ doc.search(".EventList-container > div").map do |item|
13
+ title_node = item.at("h2 a")
14
+ url = URI.join(URL, title_node["href"]).to_s
15
+ date = Time.strptime(item.at(".event-releaseDate b").content, "%d.%m.%Y")
16
+ new id: url, title: title_node.content, link: url, date: date
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,55 +1,55 @@
1
- class Eventify
2
- module Provider
3
- class Base
4
- include Comparable
5
-
6
- class << self
7
- def fetch
8
- raise NotImplementedError
9
- end
10
- end
11
-
12
- attr_reader :id, :title, :link, :date
13
-
14
- def initialize(event)
15
- @id = event[:id] or raise MissingAttributeError.new("id is missing")
16
- @title = event[:title] or raise MissingAttributeError.new("title is missing")
17
- @link = event[:link] or raise MissingAttributeError.new("link is missing")
18
- @date = event[:date]
19
- end
20
-
21
- def provider
22
- @provider ||= self.class.name
23
- end
24
-
25
- def save
26
- Database.save self
27
- self
28
- end
29
-
30
- def exists?
31
- Database.exists? self
32
- end
33
-
34
- def ==(other)
35
- id == other.id &&
36
- provider == other.provider &&
37
- title == other.title &&
38
- link == other.link &&
39
- date.to_i == other.date.to_i
40
- end
41
-
42
- alias_method :eql?, :==
43
-
44
- def hash
45
- "#{id}-#{provider}-#{title}-#{link}-#{date.to_i}".hash
46
- end
47
-
48
- def <=>(other)
49
- title <=> other.title
50
- end
51
-
52
- MissingAttributeError = Class.new(RuntimeError)
53
- end
54
- end
55
- end
1
+ class Eventify
2
+ module Provider
3
+ class Base
4
+ include Comparable
5
+
6
+ class << self
7
+ def fetch
8
+ raise NotImplementedError
9
+ end
10
+ end
11
+
12
+ attr_reader :id, :title, :link, :date
13
+
14
+ def initialize(event)
15
+ @id = event[:id] or raise MissingAttributeError.new("id is missing")
16
+ @title = event[:title] or raise MissingAttributeError.new("title is missing")
17
+ @link = event[:link] or raise MissingAttributeError.new("link is missing")
18
+ @date = event[:date]
19
+ end
20
+
21
+ def provider
22
+ @provider ||= self.class.name
23
+ end
24
+
25
+ def save
26
+ Database.save self
27
+ self
28
+ end
29
+
30
+ def exists?
31
+ Database.exists? self
32
+ end
33
+
34
+ def ==(other)
35
+ id == other.id &&
36
+ provider == other.provider &&
37
+ title == other.title &&
38
+ link == other.link &&
39
+ date.to_i == other.date.to_i
40
+ end
41
+
42
+ alias_method :eql?, :==
43
+
44
+ def hash
45
+ "#{id}-#{provider}-#{title}-#{link}-#{date.to_i}".hash
46
+ end
47
+
48
+ def <=>(other)
49
+ title <=> other.title
50
+ end
51
+
52
+ MissingAttributeError = Class.new(RuntimeError)
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,21 @@
1
+ require "open-uri"
2
+ require "nokogiri"
3
+ require "json"
4
+ require "time"
5
+
6
+ module Eventify::Provider
7
+ class Livenation < Base
8
+ URL = "https://www.livenation.ee/event/allevents"
9
+
10
+ class << self
11
+ def fetch
12
+ doc = Nokogiri::HTML(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
18
+ end
19
+ end
20
+ end
21
+ end
@@ -3,7 +3,7 @@ require "json"
3
3
 
4
4
  module Eventify::Provider
5
5
  class Piletilevi < Base
6
- URL = URI.parse("http://www.piletilevi.ee/ajaxCaller/method:getConcertsList/start:0/limit:500/id:58103/type:any/")
6
+ URL = URI.parse("https://www.piletilevi.ee/ajaxCaller/method:getConcertsListInfo/id:1089/type:catalog_category")
7
7
 
8
8
  class << self
9
9
  def fetch
@@ -1,3 +1,3 @@
1
1
  class Eventify
2
- VERSION = "1.5.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,51 +1,51 @@
1
- require "spec_helper"
2
-
3
- describe Eventify::Configuration do
4
- before do
5
- stub_const "Eventify::Configuration::PATH", File.join(Dir.tmpdir, "eventify-config.yml")
6
- File.delete Eventify::Configuration::PATH if File.exists? Eventify::Configuration::PATH
7
- end
8
-
9
- context "#initialize" do
10
- it "has default settings by default" do
11
- configuration = Eventify::Configuration.new
12
- configuration[:subscribers].should == ["user@example.org"]
13
- configuration[:mail].should == Mail.delivery_method.settings.merge(openssl_verify_mode: "none")
14
- end
15
-
16
- it "allows to override settings" do
17
- File.open(Eventify::Configuration::PATH, "w") { |f| f.write YAML.dump(foo: "baz") }
18
-
19
- configuration = Eventify::Configuration.new(foo: "bar")
20
- configuration[:foo].should == "bar"
21
- configuration[:subscribers].should == ["user@example.org"]
22
- end
23
-
24
- it "loads settings from file too" do
25
- File.open(Eventify::Configuration::PATH, "w") { |f| f.write YAML.dump(bar: "foo") }
26
-
27
- configuration = Eventify::Configuration.new(foo: "bar")
28
- configuration[:foo].should == "bar"
29
- configuration[:bar].should == "foo"
30
- configuration[:subscribers].should == ["user@example.org"]
31
- end
32
- end
33
-
34
- context "#save" do
35
- it "saves config as yaml" do
36
- Eventify::Configuration.new(foo: "bar").save
37
- YAML.load(File.read(Eventify::Configuration::PATH))[:foo].should == "bar"
38
- end
39
-
40
- it "saves subscribers as an array even if it is specified as a string" do
41
- Eventify::Configuration.new(subscribers: "foo@bar.com").save
42
- YAML.load(File.read(Eventify::Configuration::PATH))[:subscribers].should == ["foo@bar.com"]
43
- end
44
- end
45
-
46
- context "#[]" do
47
- it "retrieves configuration setting" do
48
- Eventify::Configuration.new(baz: "bar")[:baz].should == "bar"
49
- end
50
- end
51
- end
1
+ require "spec_helper"
2
+
3
+ describe Eventify::Configuration do
4
+ before do
5
+ stub_const "Eventify::Configuration::PATH", File.join(Dir.tmpdir, "eventify-config.yml")
6
+ File.delete Eventify::Configuration::PATH if File.exists? Eventify::Configuration::PATH
7
+ end
8
+
9
+ context "#initialize" do
10
+ it "has default settings by default" do
11
+ configuration = Eventify::Configuration.new
12
+ expect(configuration[:subscribers]).to eq(["user@example.org"])
13
+ expect(configuration[:mail]).to eq(Mail.delivery_method.settings.merge(openssl_verify_mode: "none"))
14
+ end
15
+
16
+ it "allows to override settings" do
17
+ File.open(Eventify::Configuration::PATH, "w") { |f| f.write YAML.dump(foo: "baz") }
18
+
19
+ configuration = Eventify::Configuration.new(foo: "bar")
20
+ expect(configuration[:foo]).to eq("bar")
21
+ expect(configuration[:subscribers]).to eq(["user@example.org"])
22
+ end
23
+
24
+ it "loads settings from file too" do
25
+ File.open(Eventify::Configuration::PATH, "w") { |f| f.write YAML.dump(bar: "foo") }
26
+
27
+ configuration = Eventify::Configuration.new(foo: "bar")
28
+ expect(configuration[:foo]).to eq("bar")
29
+ expect(configuration[:bar]).to eq("foo")
30
+ expect(configuration[:subscribers]).to eq(["user@example.org"])
31
+ end
32
+ end
33
+
34
+ context "#save" do
35
+ it "saves config as yaml" do
36
+ Eventify::Configuration.new(foo: "bar").save
37
+ expect(YAML.load(File.read(Eventify::Configuration::PATH))[:foo]).to eq("bar")
38
+ end
39
+
40
+ it "saves subscribers as an array even if it is specified as a string" do
41
+ Eventify::Configuration.new(subscribers: "foo@bar.com").save
42
+ expect(YAML.load(File.read(Eventify::Configuration::PATH))[:subscribers]).to eq(["foo@bar.com"])
43
+ end
44
+ end
45
+
46
+ context "#[]" do
47
+ it "retrieves configuration setting" do
48
+ expect(Eventify::Configuration.new(baz: "bar")[:baz]).to eq("bar")
49
+ end
50
+ end
51
+ end
@@ -19,8 +19,8 @@ describe Eventify::Database do
19
19
  )
20
20
  Eventify::Database.save event2
21
21
 
22
- Eventify::Database.events.size.should == 2
23
- Eventify::Database.events.should == [event1, event2]
22
+ expect(Eventify::Database.events.size).to eq(2)
23
+ expect(Eventify::Database.events).to eq([event1, event2])
24
24
  end
25
25
 
26
26
  it "raises an error when event already exists" do
@@ -34,7 +34,7 @@ describe Eventify::Database do
34
34
 
35
35
  expect {
36
36
  Eventify::Database.save event
37
- }.to raise_error
37
+ }.to raise_error(SQLite3::ConstraintException)
38
38
  end
39
39
  end
40
40
 
@@ -48,7 +48,7 @@ describe Eventify::Database do
48
48
  )
49
49
  Eventify::Database.save(event)
50
50
 
51
- Eventify::Database.should exist(event)
51
+ expect(Eventify::Database).to exist(event)
52
52
  end
53
53
 
54
54
  it "false when event does not exist" do
@@ -59,7 +59,7 @@ describe Eventify::Database do
59
59
  date: Time.parse("2013-12-27 12:30:11"),
60
60
  )
61
61
 
62
- Eventify::Database.should_not exist(event)
62
+ expect(Eventify::Database).not_to exist(event)
63
63
  end
64
64
 
65
65
  it "false when event id is different" do
@@ -78,7 +78,7 @@ describe Eventify::Database do
78
78
  date: Time.parse("2013-12-27 12:30:11"),
79
79
  )
80
80
 
81
- Eventify::Database.should_not exist(event2)
81
+ expect(Eventify::Database).not_to exist(event2)
82
82
  end
83
83
 
84
84
  it "false when event link is different" do
@@ -97,7 +97,7 @@ describe Eventify::Database do
97
97
  date: Time.parse("2013-12-27 12:30:11"),
98
98
  )
99
99
 
100
- Eventify::Database.should_not exist(event2)
100
+ expect(Eventify::Database).not_to exist(event2)
101
101
  end
102
102
 
103
103
  it "false when event provider is different" do
@@ -116,7 +116,7 @@ describe Eventify::Database do
116
116
  date: Time.parse("2013-12-27 12:30:11"),
117
117
  )
118
118
 
119
- Eventify::Database.should_not exist(event2)
119
+ expect(Eventify::Database).not_to exist(event2)
120
120
  end
121
121
  end
122
122
 
@@ -137,6 +137,6 @@ describe Eventify::Database do
137
137
  )
138
138
  Eventify::Database.save(event2)
139
139
 
140
- Eventify::Database.events.should == [event1, event2]
140
+ expect(Eventify::Database.events).to eq([event1, event2])
141
141
  end
142
142
  end