rock_n_roll 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d22bbae7144549061bf0af2026c1f00d9dbe83b98d8ccedf0a3c2787d668cbaa
4
- data.tar.gz: ab0c5c3474d3a338069a06579142b710fe120eee68ffc8c776a9c574a7d35b2b
3
+ metadata.gz: f3eaa3a47503a0da3cf6f05a5bddf96eb9d62da029279ff8a7fa152cfb435f1d
4
+ data.tar.gz: e38a3a7cd70f3aa0168744a89250c511dfd47a911a1d4b3d084e3eb0a468b597
5
5
  SHA512:
6
- metadata.gz: 39417988c8d751e15fcaaca4c68f77820cd4363992a91d2ead67b6e6aa86d13786e67e6ba592aadf062753b332586cad59cc756e60204520f029581753d8ce21
7
- data.tar.gz: d4ebf1074b433c8fa5bf1ab266727a08a7bef99f821c7e21d1b3e4ef24c77a8c7650cf2264070e4e2b5a9dc28811e1d07e9a60ab7ea25e836cc35d6cde6de3fd
6
+ metadata.gz: 3746f2947e560b4f18ee65056c4913fc19c17a4781cc167edca55d7ec57ea1d1a4306ee3a6739e3eb1509beb84f29fabbb281f1259b93f1ca9036ec28b14f7c2
7
+ data.tar.gz: 313a32473adb84e94aae7ec63f69f3c92d83c3bcffd527f19d991fd5133ac1cfa8047ec1a15458ce3e205778485bc32c138c25d093ffb38c29044fe56eb7cfef
@@ -1,7 +1,7 @@
1
1
  class RockNRoll::CLI
2
2
 
3
3
  def call
4
- puts "~~~~~Welcome to the Rock 'n' Roll 2018-19 races!~~~~~"
4
+ puts "~~~~~Welcome to the Rock 'n' Roll 2019-20 races!~~~~~"
5
5
  sleep(1)
6
6
  RockNRoll::Scraper.new.create_races
7
7
  show_list
@@ -36,12 +36,16 @@ class RockNRoll::CLI
36
36
  end
37
37
 
38
38
  def show_details(race)
39
- puts "~*~*~*~*~*~*~* Details for #{race.location} ~*~*~*~*~*~*~*"
40
- puts "Date(s): #{race.date}"
41
- puts "Distance(s): #{race.distances}"
42
- puts "Description: #{race.description}"
43
- puts "Event Hashtag: #{race.hashtag}"
44
- puts "Event URL: #{race.url}"
39
+ if race.location != "TBD"
40
+ puts "~*~*~*~*~*~*~* Details for #{race.location} ~*~*~*~*~*~*~*"
41
+ puts "Date(s): #{race.date}"
42
+ puts "Distance(s): #{race.distances}"
43
+ puts "Description: #{race.description}"
44
+ puts "Event Hashtag: #{race.hashtag}"
45
+ puts "Event URL: #{race.url}"
46
+ else
47
+ puts "Check back again soon for more details for this race!"
48
+ end
45
49
  end
46
50
 
47
51
  def exit_program
@@ -10,11 +10,17 @@ class RockNRoll::Race
10
10
  end
11
11
 
12
12
  def self.new_from_list(race)
13
- url = race.css("h5 a").attribute("href").text
13
+ location = race.css("h3 a").text
14
+ if location == ""
15
+ location = "TBD"
16
+ end
17
+ url = "https://www.runrocknroll.com" + race.css("h3 a").attribute("href").text
14
18
  if !url.end_with?("/")
15
19
  url += "/"
20
+ elsif url == ""
21
+ url = "TBD"
16
22
  end
17
- self.new(race.css("h5 a").text, url)
23
+ self.new(location, url)
18
24
  end
19
25
 
20
26
  def self.all
@@ -30,12 +36,12 @@ class RockNRoll::Race
30
36
  end
31
37
 
32
38
  def date
33
- @date = race_site.search("#hero span strong").text.strip
39
+ @date = race_site.search("h3 time").text.strip
34
40
  end
35
41
 
36
42
  def description
37
- @description = race_site.search("#features div.column p").first.text
38
- if @description == "Leer Más"
43
+ @description = race_site.search(".caption p").first.text.strip
44
+ if @description == "Leer Más" || @description == ""
39
45
  @description = "Please click on the race's URL for more information."
40
46
  else
41
47
  @description
@@ -43,16 +49,16 @@ class RockNRoll::Race
43
49
  end
44
50
 
45
51
  def hashtag
46
- @hashtag = race_site.search("#ribbon div.hash").text.chomp(' /')
52
+ @hashtag = race_site.search(".twitter-handle").text.chomp(' /').strip
47
53
  end
48
54
 
49
55
  def distances
50
56
  @race_distances = []
51
- distance_url = self.url + "the-races/distances/"
57
+ distance_url = self.url + "the-races/courses/"
52
58
  @distance_site = Nokogiri::HTML(open(distance_url))
53
- @distance_site.search("div.sidenav").each do |distances|
59
+ @distance_site.search("div ul.nav-justified li").each do |distances|
54
60
  distances.search("a").collect do |distance| #iterate through the XML of distances
55
- race_distance = distance.text
61
+ race_distance = distance.text.strip
56
62
  @race_distances << race_distance
57
63
  end
58
64
  end
@@ -1,8 +1,8 @@
1
1
  class RockNRoll::Scraper
2
2
 
3
3
  def scrape_races
4
- @doc = Nokogiri::HTML(open("http://www.runrocknroll.com/"))
5
- @doc.search("div.mix")
4
+ @doc = Nokogiri::HTML(open("https://www.runrocknroll.com/"))
5
+ @doc.search("div.race-item")
6
6
  end
7
7
 
8
8
  def create_races
@@ -1,3 +1,3 @@
1
1
  module RockNRoll
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rock_n_roll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'Alyssa Kim'"
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-05 00:00:00.000000000 Z
11
+ date: 2018-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.7.6
131
+ rubygems_version: 2.7.7
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: This gem returns information about Rock 'n' Roll races around the world.