hockey_orgs 0.1.1 → 0.1.2
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 +4 -4
- data/hockey_orgs-0.1.1.gem +0 -0
- data/lib/hockey_orgs/cli.rb +42 -21
- data/lib/hockey_orgs/org.rb +4 -11
- data/lib/hockey_orgs/scraper.rb +2 -6
- data/lib/hockey_orgs/version.rb +1 -1
- data/notes +24 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf4bed3846f966e744faca8a228947cb7a720ed965a2352e20e6c21f8203aa83
|
|
4
|
+
data.tar.gz: 536567a1df2961401e8732f7d9ae397cce94ba3be8fc6c4faab938b461362c2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6845d867583203dff4cb9a2ec47ad5160e6b3bf8c0103dc051cedfdf2513faa1a634f6d9aec0509b851504fae2c9526e5c1691d144dde660224276a7739a2d8
|
|
7
|
+
data.tar.gz: ffb61a38782191dc7f37feb31b3dccc70561e94a2f57e1a105cd7a712b433934e2284b065dcfb890e9e68e61629520d999b9e30725a186eb9a2a4f5933cafd4a
|
|
Binary file
|
data/lib/hockey_orgs/cli.rb
CHANGED
|
@@ -3,13 +3,14 @@ class Cli
|
|
|
3
3
|
|
|
4
4
|
def call
|
|
5
5
|
Scraper.create_orgs
|
|
6
|
+
Cli.hello
|
|
6
7
|
Scraper.list_orgs
|
|
7
8
|
Cli.org_menu
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def self.org_menu #top level menu, choose an
|
|
11
12
|
puts ""
|
|
12
|
-
puts "Enter the number of the team you would like to learn about
|
|
13
|
+
puts "Enter the number of the team you would like to learn about, or type exit to quit:"
|
|
13
14
|
input = gets.chomp
|
|
14
15
|
@i = input.to_i - 1
|
|
15
16
|
if input.downcase == 'exit'
|
|
@@ -17,6 +18,10 @@ class Cli
|
|
|
17
18
|
elsif @i < 0 or @i >= 31
|
|
18
19
|
puts ""
|
|
19
20
|
puts "invalid input"
|
|
21
|
+
sleep(1.2)
|
|
22
|
+
puts ""
|
|
23
|
+
Scraper.list_orgs
|
|
24
|
+
self.org_menu
|
|
20
25
|
else
|
|
21
26
|
puts ""
|
|
22
27
|
self.org_options(@i)
|
|
@@ -26,20 +31,19 @@ class Cli
|
|
|
26
31
|
def self.org_options(i) #provide options for learning about the organization
|
|
27
32
|
name = Org.all[@i].name
|
|
28
33
|
puts "What would you like to know about the #{name}?(type exit to return to team selection)"
|
|
34
|
+
puts ''
|
|
29
35
|
puts "1. Arena Name 2. Year of founding 3. What division do they play in?"
|
|
30
36
|
self.org_choice
|
|
31
|
-
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
def self.same_founding(input) #check if other teams were founded the same year
|
|
35
40
|
teams = []
|
|
36
41
|
arr = []
|
|
37
|
-
puts "Would you like to see all other teams founded that year?(please type
|
|
42
|
+
puts "Would you like to see all other teams founded that year?(please type Y or N)"
|
|
38
43
|
input = gets.chomp.downcase
|
|
39
44
|
case input
|
|
40
45
|
when 'y'
|
|
41
46
|
Org.all.each do |o|
|
|
42
|
-
#binding.pry
|
|
43
47
|
if o.founding == Org.all[@i].founding && o.name != Org.all[@i].name
|
|
44
48
|
arr << o.name
|
|
45
49
|
end
|
|
@@ -47,41 +51,52 @@ class Cli
|
|
|
47
51
|
if arr.size > 0
|
|
48
52
|
puts arr
|
|
49
53
|
else
|
|
50
|
-
|
|
54
|
+
#binding.pry
|
|
55
|
+
puts "The #{Org.all[@i].name} were the only team founded in #{Org.all[@i].founding}"
|
|
51
56
|
end
|
|
57
|
+
self.more_info
|
|
52
58
|
when 'n'
|
|
53
|
-
self.
|
|
59
|
+
self.more_info
|
|
54
60
|
else
|
|
55
|
-
|
|
61
|
+
puts ""
|
|
62
|
+
puts "Invalid input"
|
|
63
|
+
puts ""
|
|
64
|
+
self.same_founding(@i)
|
|
56
65
|
end
|
|
66
|
+
|
|
57
67
|
end
|
|
58
68
|
|
|
59
69
|
def self.org_choice
|
|
60
70
|
choice = gets.chomp
|
|
61
|
-
|
|
71
|
+
case choice
|
|
72
|
+
when "exit"
|
|
62
73
|
puts ""
|
|
63
74
|
puts "returning you to main menu"
|
|
64
75
|
Scraper.list_orgs
|
|
65
76
|
Cli.org_menu
|
|
66
|
-
|
|
67
|
-
puts ""
|
|
77
|
+
when '1'
|
|
68
78
|
Org.get_arena(@i)
|
|
69
|
-
self.more_org_options
|
|
70
|
-
elsif choice == '2'
|
|
71
79
|
puts ""
|
|
80
|
+
self.more_info
|
|
81
|
+
when '2'
|
|
72
82
|
Org.get_founding(@i)
|
|
83
|
+
sleep(0.8)
|
|
73
84
|
self.same_founding(@i)
|
|
74
|
-
|
|
75
|
-
elsif choice == '3'
|
|
76
|
-
puts ""
|
|
85
|
+
when '3'
|
|
77
86
|
Org.get_division(@i)
|
|
78
|
-
|
|
87
|
+
puts ""
|
|
88
|
+
self.more_info
|
|
89
|
+
else
|
|
90
|
+
#binding.pry
|
|
91
|
+
puts ""
|
|
92
|
+
puts "Invalid input"
|
|
93
|
+
puts ""
|
|
94
|
+
self.org_options(@i)
|
|
79
95
|
end
|
|
80
|
-
|
|
81
96
|
end
|
|
82
97
|
|
|
83
|
-
def self.
|
|
84
|
-
puts "Would you like more info on The #{Org.all[@i].name}?(Please
|
|
98
|
+
def self.more_info
|
|
99
|
+
puts "Would you like more info on The #{Org.all[@i].name}?(Please type Y or N)"
|
|
85
100
|
input = gets.chomp
|
|
86
101
|
case input
|
|
87
102
|
when 'y'
|
|
@@ -90,12 +105,18 @@ class Cli
|
|
|
90
105
|
Scraper.list_orgs
|
|
91
106
|
self.org_menu
|
|
92
107
|
else
|
|
93
|
-
puts "Invalid input! Please
|
|
94
|
-
self.
|
|
108
|
+
puts "Invalid input! Please type Y or N"
|
|
109
|
+
self.more_info
|
|
95
110
|
end
|
|
96
111
|
|
|
97
112
|
end
|
|
98
113
|
|
|
114
|
+
def self.hello
|
|
115
|
+
puts "Hello and welcome to Hockey Orgs! Below you will find a list of all active NHL franchises:"
|
|
116
|
+
|
|
117
|
+
puts " "
|
|
118
|
+
end
|
|
119
|
+
|
|
99
120
|
def self.goodbye
|
|
100
121
|
puts ""
|
|
101
122
|
puts "Thank you for your interest in the NHL, it was an honor to serve you."
|
data/lib/hockey_orgs/org.rb
CHANGED
|
@@ -18,22 +18,15 @@ class Org
|
|
|
18
18
|
@@all
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def self.get_arena(input)
|
|
22
|
-
#
|
|
23
|
-
puts "The #{self.all[input].name} play at the #{self.all[input].stadium} in #{@@all[input].city}."
|
|
21
|
+
def self.get_arena(input) #these are pretty straight forward i like to think
|
|
22
|
+
puts "The #{@@all[input].name} play at the #{@@all[input].stadium} in #{@@all[input].city}."
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def self.get_founding(input)
|
|
27
|
-
puts "The #{
|
|
26
|
+
puts "The #{@@all[input].name} were founded in #{@@all[input].founding}."
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def self.get_division(input)
|
|
31
|
-
puts "The #{
|
|
30
|
+
puts "The #{@@all[input].name} play in the #{@@all[input].division} Division of the NHL."
|
|
32
31
|
end
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
32
|
end
|
data/lib/hockey_orgs/scraper.rb
CHANGED
|
@@ -4,8 +4,7 @@ class Scraper
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def self.create_orgs #instantiates the
|
|
8
|
-
#binding.pry
|
|
7
|
+
def self.create_orgs #instantiates an "org" for every team in the NHL
|
|
9
8
|
response = RestClient.get(URL)
|
|
10
9
|
data = JSON.parse(response.body)["teams"]
|
|
11
10
|
x = data.sort_by {|o| o["name"]}
|
|
@@ -14,10 +13,7 @@ class Scraper
|
|
|
14
13
|
end
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
def self.list_orgs #numbered list of organizations for selection
|
|
18
|
-
puts "Hello and welcome to Hockey Orgs! Below you will find a list of all active NHL franchises:"
|
|
19
|
-
sleep(1)
|
|
20
|
-
puts " "
|
|
16
|
+
def self.list_orgs #prints a numbered list of organizations for selection
|
|
21
17
|
Org.all.each do |o|
|
|
22
18
|
#binding.pry
|
|
23
19
|
puts "#{o.id}. #{o.name}"
|
data/lib/hockey_orgs/version.rb
CHANGED
data/notes
CHANGED
|
@@ -49,3 +49,27 @@ the problems right now(order of importance)
|
|
|
49
49
|
3. clean it up, check out seperation of concerns
|
|
50
50
|
|
|
51
51
|
just needs to be done sunday night but tomorrow would be great
|
|
52
|
+
|
|
53
|
+
alright i think we're done here
|
|
54
|
+
still need to check out seperation of concerns
|
|
55
|
+
maybe move a method around here or there(class to class)
|
|
56
|
+
|
|
57
|
+
1. get it up on github
|
|
58
|
+
2. make a video
|
|
59
|
+
3. write a blog
|
|
60
|
+
4. schedule assessment
|
|
61
|
+
done
|
|
62
|
+
|
|
63
|
+
you messed up two things:
|
|
64
|
+
didn't screen record half an hour of coding
|
|
65
|
+
didn't use github like at all the way it was meant to be used and paid a price
|
|
66
|
+
|
|
67
|
+
you did a few great things:
|
|
68
|
+
went above and beyond
|
|
69
|
+
worked through the bullshit(that was your own fault sometimes)
|
|
70
|
+
you have never built a piece of software before and now, here is one
|
|
71
|
+
|
|
72
|
+
OKAY FORGET ALL THAT OTHER STUFF
|
|
73
|
+
the organization sub-menu can't handle invalid inputs! fuck!
|
|
74
|
+
OKAY FORGET THAT
|
|
75
|
+
it can do it now
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hockey_orgs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Wilder
|
|
@@ -85,6 +85,7 @@ files:
|
|
|
85
85
|
- bin/hockey_orgs
|
|
86
86
|
- bin/setup
|
|
87
87
|
- hockey_orgs-0.1.0.gem
|
|
88
|
+
- hockey_orgs-0.1.1.gem
|
|
88
89
|
- hockey_orgs.gemspec
|
|
89
90
|
- lib/.DS_Store
|
|
90
91
|
- lib/hockey_orgs.rb
|