soccer-quiz 0.2.2 → 0.2.4

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: 7b545d394c53f35ee35d2a74220fbe15573c82ffa186ed52f38d2d98adfee139
4
- data.tar.gz: 02b811afe34cbb3c7a3b81483acf442d00fce359f4f0ae50fa22bb28bc8f4235
3
+ metadata.gz: b65ffa6704f8dfe3f0ee837dddc77407187a33ccf805df45519ffee531013399
4
+ data.tar.gz: 286d245df0903b1d4fc709b195ee38dfada98588c92117ca5f36e8d87d4b32c0
5
5
  SHA512:
6
- metadata.gz: 32b69793579c3d20ade59556c97dd8a48dcdb718f5d3ad46d74aa365016e5a95c504bb0f50fd09bfc20e09ff1ef57babd2765a82309da70c57c1734b9025ea07
7
- data.tar.gz: 249bea93e60380e250f8110cb2e4bcf97ab36af1d9db58fd140fbeba4a4279ae0ceb2e62e36aae97ea07a9d81aa9b76da65dc0c49047d6bc93e2061b894e536e
6
+ metadata.gz: def75980f2134e5e7ca0812acab4a7baf85b97180e40d6b8f7db621a30a638ed4d7c6216e19d8f42439657241708ed0dc05319fadbcab6d8ed8b25df334b08d8
7
+ data.tar.gz: 218b97aa875bddd21923d9d7e21643d23094626fd7e4baf272cce3a9bb78e08bf9c4b13f42ca7baa93185cdd3354d57ef5605b39761b221987697d76a66bd1ff
data/.DS_Store ADDED
Binary file
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source "https://rubygems.org"
2
-
2
+ gem "nokogiri"
3
+ gem 'open-uri'
3
4
  # Specify your gem's dependencies in quiz.gemspec
4
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,15 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soccer-quiz (0.2.1)
4
+ soccer-quiz (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ date (3.2.2)
9
10
  diff-lcs (1.3)
10
- mini_portile2 (2.4.0)
11
- nokogiri (1.10.9)
12
- mini_portile2 (~> 2.4.0)
11
+ mini_portile2 (2.8.0)
12
+ nokogiri (1.13.8)
13
+ mini_portile2 (~> 2.8.0)
14
+ racc (~> 1.4)
15
+ open-uri (0.2.0)
16
+ stringio
17
+ time
18
+ uri
19
+ racc (1.6.0)
13
20
  rake (13.0.1)
14
21
  rspec (3.9.0)
15
22
  rspec-core (~> 3.9.0)
@@ -24,6 +31,10 @@ GEM
24
31
  diff-lcs (>= 1.2.0, < 2.0)
25
32
  rspec-support (~> 3.9.0)
26
33
  rspec-support (3.9.3)
34
+ stringio (3.0.2)
35
+ time (0.2.0)
36
+ date
37
+ uri (0.11.0)
27
38
 
28
39
  PLATFORMS
29
40
  ruby
@@ -31,6 +42,7 @@ PLATFORMS
31
42
  DEPENDENCIES
32
43
  bundler
33
44
  nokogiri
45
+ open-uri
34
46
  rake (>= 12.3.3)
35
47
  rspec
36
48
  soccer-quiz!
data/bin/console CHANGED
@@ -2,10 +2,12 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "quiz"
5
+ require_relative '../lib/quiz'
5
6
 
6
7
  # (If you use this, don't forget to add pry to your Gemfile!)
7
8
  # require "pry"
8
9
  # Pry.start
9
10
 
10
- require "irb"
11
- IRB.start(__FILE__)
11
+ # require "irb"
12
+ # IRB.start(__FILE__)
13
+ Quiz::Scraper.nyc_buildings_violations
data/bin/quiz CHANGED
@@ -1,2 +1,3 @@
1
1
  require_relative '../lib/quiz'
2
2
  Quiz::CLI.new.call
3
+
data/lib/.DS_Store ADDED
Binary file
data/lib/quiz/scraper.rb CHANGED
@@ -3,62 +3,67 @@ class Quiz::Scraper
3
3
 
4
4
 
5
5
  def self.scraper(url,clas)
6
- doc = Nokogiri::HTML(open(url))
6
+ doc = Nokogiri::HTML(URI.open(url))
7
7
  doc.css(clas)
8
8
  end
9
9
 
10
- def self.balon_d_or_players
10
+ def self.balon_d_or_players
11
11
  balon_d_or_url = "https://www.goal.com/es/noticias/todos-los-ganadores-del-balon-de-oro/wn19xivn1eh91t0jrslbzz5kq"
12
12
  balon_de_or_files = "table"
13
13
 
14
14
  players = self.scraper(balon_d_or_url,balon_de_or_files).map{|l|l.text}
15
- years = players[1].split(/\D/).reject{|e|e.empty?}
16
- years[1] = "2020"
17
- players = players[1].split(/\d/).reject{|e|e.empty?}
18
- players[0] = "Lionel Messi"
19
- players[1] = "Event was Cancel because Covi-19"
15
+ years = players[0].split(/\D/).reject{|e|e.empty?}
16
+ years[2] = "2020"
17
+ players = players[0].split(/\d/).reject{|e|e.empty?}
18
+ players[0] = "Karim Benzema"
19
+ players[2] = "Event was Cancel because Covi-19"
20
20
  counter = 0
21
21
  all_players = []
22
22
  while counter < players.size
23
23
  all_players << {:winner => players[counter],:year => years[counter]}
24
24
  counter += 1
25
25
  end
26
-
27
- p all_players
26
+ all_players
28
27
  end
29
28
 
30
29
 
31
30
  def self.world_cup
32
- world_cup_url = "https://www.foxsports.com/soccer/fifa-world-cup/history"
31
+ world_cup_url = "https://en.wikipedia.org/wiki/List_of_FIFA_World_Cup_finals"
33
32
  world_cup = "tbody"
34
33
  world_cup = self.scraper(world_cup_url,world_cup).map{|l|l.text.split(/\r\n|\s{2,}/).reject{|e|e.empty?}}
34
+ world_cup = world_cup[3]
35
+ 8.times{world_cup.shift}
36
+ 3.times{world_cup.pop}
37
+
35
38
  counter = 0
36
39
  all_countries = []
37
- while counter < world_cup[0].size
38
- all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter + 1], :winner => world_cup[0][counter + 2], :runner_up => world_cup[0][counter + 3], :thirth_place => world_cup[0][counter + 4]}
39
- counter += 9
40
+ while counter < world_cup.size
41
+ all_countries << {:year => world_cup[counter], :host => world_cup[counter + 5], :winner => world_cup[counter + 1], :runner_up => world_cup[counter + 3]}
42
+ counter += 8
40
43
  end
41
44
  all_countries
42
45
  end
43
-
44
- def self.champion_league
46
+ def self.champion_league
45
47
  champion_league_url = "https://en.wikipedia.org/wiki/List_of_European_Cup_and_UEFA_Champions_League_finals"
46
48
  champion_league_file = "tbody"
47
49
 
48
50
  champions = self.scraper(champion_league_url,champion_league_file).map{|l|l.text.split("\n").reject{|e|e.empty?}}
51
+
49
52
  champions[0].shift
50
53
  champions.shift
51
54
  champions.shift
52
- 10.times{champions[0].shift}
53
- 23.times{champions[0].pop}
55
+ 8.times{champions[0].shift}
56
+
57
+ 14.times{champions[0].pop}
54
58
  2.times{champions[0].delete_at(152)}
55
59
  counter = 0
56
60
  all_teams = []
57
61
  while counter < champions[0].size
58
- all_teams << {:year => champions[0][counter], :winner => champions[0][counter + 2], :score => champions[0][counter + 3], :runner_up => champions[0][counter + 5], :host => champions[0][counter + 6]}
59
- counter += 8
62
+ all_teams << {:year => champions[0][counter], :winner => champions[0][counter + 2], :score => champions[0][counter + 3], :runner_up => champions[0][counter + 4], :host => champions[0][counter + 6]}
63
+ counter += 8
60
64
  end
61
- all_teams
62
- end
65
+ all_teams
66
+ end
67
+
63
68
  end
64
69
 
data/lib/quiz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Quiz
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/quiz.rb CHANGED
@@ -4,3 +4,6 @@ module Quiz
4
4
  class Error < StandardError; end
5
5
  end
6
6
  require_relative '../config/environment'
7
+
8
+
9
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soccer-quiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yarvin Hernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-17 00:00:00.000000000 Z
11
+ date: 2024-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
+ - ".DS_Store"
77
78
  - ".gitignore"
78
79
  - CODE_OF_CONDUCT.md
79
80
  - Gemfile
@@ -85,12 +86,12 @@ files:
85
86
  - bin/console
86
87
  - bin/htmldiff
87
88
  - bin/ldiff
88
- - bin/nokogiri
89
89
  - bin/quiz
90
90
  - bin/rake
91
91
  - bin/rspec
92
92
  - bin/setup
93
93
  - config/environment.rb
94
+ - lib/.DS_Store
94
95
  - lib/quiz.rb
95
96
  - lib/quiz/balon_d_or.rb
96
97
  - lib/quiz/champion_league.rb
@@ -119,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubygems_version: 3.0.8
123
+ rubygems_version: 3.3.7
123
124
  signing_key:
124
125
  specification_version: 4
125
126
  summary: 10 questions quiz about soccer.
data/bin/nokogiri DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'nokogiri' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("nokogiri", "nokogiri")