soccer-quiz 0.2.1 → 0.2.3

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: 9ee9a6f60dee393b50387285cbb49dfab3e94334d05ab9e3904baa75306a4119
4
- data.tar.gz: a1355ba0622dc0297c58f97340d1b56e5ba27d197949c7af1774d7755dfc1da3
3
+ metadata.gz: 58f9e7aec23eb5f33341e9e87a1de33647da4c2ab372bc38d2cb7d2e9f80a66e
4
+ data.tar.gz: 4fe91c8ed3673bfa59895bc1b18e2fe59489a342fe829ebbeb9abc8f2e4ddc9d
5
5
  SHA512:
6
- metadata.gz: 3894568fdac4b44564915ba464833fc2d6a0b29e3f613f0194fe5492fef4e09070e38d6662940a539d82e053f4cdc521c3305c65e50939574dc12987a2281944
7
- data.tar.gz: aad7ccdaf0117f3221dda2c79e26b3bac79def39bc79880377427d9f75ef225bc147e8a748a3a190aef08e910e5cd2dc71ba885174b6a0b0503f3aeb1704161a
6
+ metadata.gz: 3f5490144a6172a4e58b96e1e3e7745befb0ae747a68d6744ebf71c5e1950e3e3ab5047b560882f8ec6b6b3f4c62f8e08c8d1bee33d23742cda0fce886a85b97
7
+ data.tar.gz: 0aab7a0d118a1fcbd1da3358db069292809ff5df84180f5f005a8c0bf75cf4423cc996a699958606fd29f19e2effcc76659e28e33d2a223f231706c6debd193f
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,35 +3,40 @@ 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
- balon_de_or_files = ".tableizer-table"
13
- players = self.scraper(balon_d_or_url,balon_de_or_files).map{|l|l.text.split(/\t|\*/).reject{|e|e.empty? || e.include?("(FIFA Balón de Oro)")}}
14
- 2.times{players[0].shift}
15
- players[0][16] = "Lionel Messi"
12
+ balon_de_or_files = "table"
13
+
14
+ players = self.scraper(balon_d_or_url,balon_de_or_files).map{|l|l.text}
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"
16
20
  counter = 0
17
21
  all_players = []
18
- while counter < players[0].size
19
- all_players << {:winner => players[0][counter],:year => players[0][counter + 1]}
20
- counter += 2
22
+ while counter < players.size
23
+ all_players << {:winner => players[counter],:year => years[counter]}
24
+ counter += 1
21
25
  end
22
- all_players
26
+ all_players
23
27
  end
24
28
 
25
29
 
26
30
  def self.world_cup
27
31
  world_cup_url = "https://www.foxsports.com/soccer/fifa-world-cup/history"
28
32
  world_cup = "tbody"
33
+
29
34
  world_cup = self.scraper(world_cup_url,world_cup).map{|l|l.text.split(/\r\n|\s{2,}/).reject{|e|e.empty?}}
30
35
  counter = 0
31
36
  all_countries = []
32
37
  while counter < world_cup[0].size
33
- 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]}
34
- counter += 9
38
+ all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter + 4], :winner => world_cup[0][counter + 1], :runner_up => world_cup[0][counter + 2], :thirth_place => world_cup[0][counter + 3]}
39
+ counter += 8
35
40
  end
36
41
  all_countries
37
42
  end
@@ -45,15 +50,17 @@ class Quiz::Scraper
45
50
  champions.shift
46
51
  champions.shift
47
52
  10.times{champions[0].shift}
48
- 23.times{champions[0].pop}
53
+ 21.times{champions[0].pop}
49
54
  2.times{champions[0].delete_at(152)}
55
+ champions
50
56
  counter = 0
51
57
  all_teams = []
52
58
  while counter < champions[0].size
53
59
  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]}
54
60
  counter += 8
55
61
  end
56
- all_teams
62
+ all_teams
57
63
  end
64
+
58
65
  end
59
66
 
data/lib/quiz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Quiz
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.3"
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
+
Binary file
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.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yarvin Hernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-18 00:00:00.000000000 Z
11
+ date: 2023-04-21 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
@@ -99,6 +100,7 @@ files:
99
100
  - lib/quiz/version.rb
100
101
  - lib/quiz/world_cup.rb
101
102
  - quiz.gemspec
103
+ - soccer-quiz-0.2.1.gem
102
104
  homepage: https://rubygems.org/gems/soccer_quiz
103
105
  licenses:
104
106
  - MIT
@@ -118,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
120
  - !ruby/object:Gem::Version
119
121
  version: '0'
120
122
  requirements: []
121
- rubygems_version: 3.0.8
123
+ rubygems_version: 3.3.22
122
124
  signing_key:
123
125
  specification_version: 4
124
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")