rock_n_roll 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/lib/rock_n_roll/race.rb +27 -12
- data/lib/rock_n_roll/version.rb +1 -1
- data/rock_n_roll.gemspec +4 -5
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a1d3ec5bd587ae5252d86e9b10618dd0b1f2c0450aa20e10a1a8f4a33edd07c
|
4
|
+
data.tar.gz: 99d41a22f29b20c87bf9836ecd42b2c19387517493c34fbdaea7444ac5bae665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c64bc526db9f3653aa57f01e0d1bff340cc6e7d0e95b5827b705baf2930c031073a50133efbb908c365bdc1b3fca150058e566f0f8b51028f1ab2933dd7cd4f
|
7
|
+
data.tar.gz: a77caaf8762d6c18b5aa2c5f01e337476436e9165a4199648cb768f60ae4165e2b8ad8003534ec40fd1a47e0a662d9543e59d1bb9eb3248248aebe95bf55d095
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rock_n_roll (0.
|
4
|
+
rock_n_roll (0.2.0)
|
5
5
|
nokogiri
|
6
6
|
|
7
7
|
GEM
|
@@ -10,9 +10,9 @@ GEM
|
|
10
10
|
coderay (1.1.2)
|
11
11
|
diff-lcs (1.3)
|
12
12
|
method_source (0.9.0)
|
13
|
-
mini_portile2 (2.
|
14
|
-
nokogiri (1.
|
15
|
-
mini_portile2 (~> 2.
|
13
|
+
mini_portile2 (2.4.0)
|
14
|
+
nokogiri (1.9.1)
|
15
|
+
mini_portile2 (~> 2.4.0)
|
16
16
|
pry (0.11.3)
|
17
17
|
coderay (~> 1.1.0)
|
18
18
|
method_source (~> 0.9.0)
|
@@ -42,4 +42,4 @@ DEPENDENCIES
|
|
42
42
|
rspec
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
1.16.
|
45
|
+
1.16.2
|
data/lib/rock_n_roll/race.rb
CHANGED
@@ -14,12 +14,14 @@ class RockNRoll::Race
|
|
14
14
|
if location == ""
|
15
15
|
location = "TBD"
|
16
16
|
end
|
17
|
+
|
17
18
|
url = "https://www.runrocknroll.com" + race.css("h3 a").attribute("href").text
|
18
19
|
if !url.end_with?("/")
|
19
20
|
url += "/"
|
20
21
|
elsif url == ""
|
21
22
|
url = "TBD"
|
22
23
|
end
|
24
|
+
|
23
25
|
self.new(location, url)
|
24
26
|
end
|
25
27
|
|
@@ -36,15 +38,23 @@ class RockNRoll::Race
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def date
|
39
|
-
|
41
|
+
if self.url != "https://www.runrocknroll.com/en/events/virtual-run/"
|
42
|
+
@date = race_site.search("h3 time").text.strip
|
43
|
+
else
|
44
|
+
@date = "Dates vary. Please check https://www.runrocknroll.com/en/events/virtual-run for more details!"
|
45
|
+
end
|
40
46
|
end
|
41
47
|
|
42
48
|
def description
|
43
|
-
|
44
|
-
|
45
|
-
@description = "Please click on the race's URL for more information."
|
49
|
+
if self.url == "https://www.runrocknroll.com/en/events/virtual-run/"
|
50
|
+
@description = "Sign up for a Virtual Rock N Roll Race! Visit https://www.runrocknroll.com/en/events/virtual-run for more details."
|
46
51
|
else
|
47
|
-
@description
|
52
|
+
@description = race_site.search(".caption p").first.text.strip
|
53
|
+
if @description == "Leer Más" || @description == ""
|
54
|
+
@description = "Please click on the race's URL for more information."
|
55
|
+
else
|
56
|
+
@description
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
@@ -54,14 +64,19 @@ class RockNRoll::Race
|
|
54
64
|
|
55
65
|
def distances
|
56
66
|
@race_distances = []
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
67
|
+
if self.url == "https://www.runrocknroll.com/en/events/virtual-run/"
|
68
|
+
@distances = "Distances vary. Please visit https://www.runrocknroll.com/en/events/virtual-run for more details!"
|
69
|
+
else
|
70
|
+
distance_url = self.url + "the-races/courses/"
|
71
|
+
@distance_site = Nokogiri::HTML(open(distance_url))
|
72
|
+
@distance_site.search("div ul.nav-justified li").each do |distances|
|
73
|
+
distances.search("a").collect do |distance| #iterate through the XML of distances
|
74
|
+
race_distance = distance.text.strip
|
75
|
+
@race_distances << race_distance
|
76
|
+
end
|
63
77
|
end
|
78
|
+
@distances = @race_distances.join(", ")
|
64
79
|
end
|
65
|
-
@distances = @race_distances.join(", ")
|
66
80
|
end
|
81
|
+
|
67
82
|
end
|
data/lib/rock_n_roll/version.rb
CHANGED
data/rock_n_roll.gemspec
CHANGED
@@ -6,8 +6,8 @@ require "rock_n_roll/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rock_n_roll"
|
8
8
|
spec.version = RockNRoll::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Alyssa Kim"]
|
10
|
+
spec.email = ["alyssa.kim@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{This gem returns information about Rock 'n' Roll races around the world.}
|
13
13
|
spec.description = %q{This gem provides information on cities, dates, distances, hashtags, and URLs to Rock 'n' Roll races worldwide.}
|
@@ -26,8 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
27
|
f.match(%r{^(test|spec|features)/})
|
28
28
|
end
|
29
|
-
spec.
|
30
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.executables << "rock-n-roll"
|
31
30
|
spec.require_paths = ["lib"]
|
32
31
|
|
33
32
|
spec.add_development_dependency "bundler", "~> 1.16"
|
@@ -35,4 +34,4 @@ Gem::Specification.new do |spec|
|
|
35
34
|
spec.add_development_dependency "pry"
|
36
35
|
spec.add_development_dependency "rspec"
|
37
36
|
spec.add_dependency "nokogiri"
|
38
|
-
end
|
37
|
+
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Alyssa Kim
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -83,8 +83,9 @@ dependencies:
|
|
83
83
|
description: This gem provides information on cities, dates, distances, hashtags,
|
84
84
|
and URLs to Rock 'n' Roll races worldwide.
|
85
85
|
email:
|
86
|
-
-
|
87
|
-
executables:
|
86
|
+
- alyssa.kim@gmail.com
|
87
|
+
executables:
|
88
|
+
- rock-n-roll
|
88
89
|
extensions: []
|
89
90
|
extra_rdoc_files: []
|
90
91
|
files:
|