nfl-teams 0.0.1
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 +7 -0
- data/README.md +30 -0
- data/lib/nfl_teams/data.rb +161 -0
- data/lib/nfl_teams.rb +25 -0
- data/nfl-teams.gemspec +14 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3333d3c4e662719f1a4d02e12550ed05cb53a58e7be2bc747e7be2576978827b
|
4
|
+
data.tar.gz: 4d36ddf30a23ff08cde4128763a1a64ace2852da36d88fe22c626d3826e21c1b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a4ddb63d88a2cedc75ba03c9102de07ecccab34814f4039e2083057ab5993fb1b88e0d6c1d245243d51583b11f0aac938a7cd7f39556d821c134d4542d7d6d87
|
7
|
+
data.tar.gz: c0ab132d60a1a12c19d279e2953b5b03da9da3a14aa9fa26ac6a0deb6e4ac895cd12aaff1215d5f7e2fbbc016a4caff92bfd745698acca303cdf85cf58068bfa
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# nfl-teams
|
2
|
+
|
3
|
+
A simple library containing team name information about current NFL teams.
|
4
|
+
|
5
|
+
## API Doc
|
6
|
+
|
7
|
+
A Team Hash includes:
|
8
|
+
* `:location` - Example: `"Green Bay"`
|
9
|
+
* `:name` - Example: `"Packers"`
|
10
|
+
* `:abbreviation` - Example: `"GB"`
|
11
|
+
|
12
|
+
**`NFLTeams.all`**
|
13
|
+
|
14
|
+
Returns array of team hashes: `[ { location: "Green Bay", name: "Packers", abbreviation: "GB" } , ... ] `
|
15
|
+
|
16
|
+
**`NFLTeams.full_names`**
|
17
|
+
|
18
|
+
Returns array of team full names: `[ "Arizona Cardinals", "Atlanta Falcons", ... ]`
|
19
|
+
|
20
|
+
**`NFLTeams.abbreviation()`**
|
21
|
+
|
22
|
+
Returns the `abbrevation` for a team.
|
23
|
+
|
24
|
+
If given a `name` it will return an `abbreviation` or `nil`.
|
25
|
+
|
26
|
+
If given a `location` it will return an `abbreviation`, and array of `abbrevation`s if there are multiple teams in that location, or `nil`.
|
27
|
+
|
28
|
+
# Disclaimer
|
29
|
+
|
30
|
+
`nfl-teams` is in no way associated with the National Football League, and does not claim this data as its own.
|
@@ -0,0 +1,161 @@
|
|
1
|
+
module NFLTeams
|
2
|
+
module Data
|
3
|
+
TEAMS = [
|
4
|
+
{
|
5
|
+
location: "Arizona",
|
6
|
+
name: "Cardinals",
|
7
|
+
abbreviation: "ARI"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
location: "Atlanta",
|
11
|
+
name: "Falcons",
|
12
|
+
abbreviation: "ATL"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
location: "Baltimore",
|
16
|
+
name: "Ravens",
|
17
|
+
abbreviation: "BAL"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
location: "Buffalo",
|
21
|
+
name: "Bills",
|
22
|
+
abbreviation: "BUF"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
location: "Carolina",
|
26
|
+
name: "Panthers",
|
27
|
+
abbreviation: "CAR"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
location: "Chicago",
|
31
|
+
name: "Bears",
|
32
|
+
abbreviation: "CHI"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
location: "Cincinnati",
|
36
|
+
name: "Bengals",
|
37
|
+
abbreviation: "CIN"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
location: "Dallas",
|
41
|
+
name: "Cowboys",
|
42
|
+
abbreviation: "DAL"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
location: "Denver",
|
46
|
+
name: "Broncos",
|
47
|
+
abbreviation: "DEN"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
location: "Detroit",
|
51
|
+
name: "Lions",
|
52
|
+
abbreviation: "DET"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
location: "Green Bay",
|
56
|
+
name: "Packers",
|
57
|
+
abbreviation: "GB"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
location: "Houston",
|
61
|
+
name: "Texans",
|
62
|
+
abbreviation: "HOU"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
location: "Indianapolis",
|
66
|
+
name: "Colts",
|
67
|
+
abbreviation: "IND"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
location: "Jacksonville",
|
71
|
+
name: "Jaguars",
|
72
|
+
abbreviation: "JAX"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
location: "Kansas City",
|
76
|
+
name: "Chiefs",
|
77
|
+
abbreviation: "KC"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
location: "Los Angeles",
|
81
|
+
name: "Chargers",
|
82
|
+
abbreviation: "LAC"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
location: "Los Angeles",
|
86
|
+
name: "Rams",
|
87
|
+
abbreviation: "LAR"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
location: "Miami",
|
91
|
+
name: "Dolphins",
|
92
|
+
abbreviation: "MIA"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
location: "Minnesota",
|
96
|
+
name: "Vikings",
|
97
|
+
abbreviation: "MIN"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
location: "New England",
|
101
|
+
name: "Patriots",
|
102
|
+
abbreviation: "NE"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
location: "New Orleans",
|
106
|
+
name: "Saints",
|
107
|
+
abbreviation: "NO"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
location: "New York",
|
111
|
+
name: "Giants",
|
112
|
+
abbreviation: "NYG"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
location: "New York",
|
116
|
+
name: "Jets",
|
117
|
+
abbreviation: "NYJ"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
location: "Oakland",
|
121
|
+
name: "Raiders",
|
122
|
+
abbreviation: "OAK"
|
123
|
+
},
|
124
|
+
{
|
125
|
+
location: "Philadelphia",
|
126
|
+
name: "Eagles",
|
127
|
+
abbreviation: "PHI"
|
128
|
+
},
|
129
|
+
{
|
130
|
+
location: "Pittsburgh",
|
131
|
+
name: "Steelers",
|
132
|
+
abbreviation: "PIT"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
location: "Seattle",
|
136
|
+
name: "Seahawks",
|
137
|
+
abbreviation: "SEA"
|
138
|
+
},
|
139
|
+
{
|
140
|
+
location: "San Francisco",
|
141
|
+
name: "49ers",
|
142
|
+
abbreviation: "SF"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
location: "Tampa Bay",
|
146
|
+
name: "Buccaneers",
|
147
|
+
abbreviation: "TB"
|
148
|
+
},
|
149
|
+
{
|
150
|
+
location: "Tennessee",
|
151
|
+
name: "Titans",
|
152
|
+
abbreviation: "TEN"
|
153
|
+
},
|
154
|
+
{
|
155
|
+
location: "Washington",
|
156
|
+
name: "Redskins",
|
157
|
+
abbreviation: "WAS"
|
158
|
+
}
|
159
|
+
].freeze
|
160
|
+
end
|
161
|
+
end
|
data/lib/nfl_teams.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative "nfl_teams/data"
|
2
|
+
|
3
|
+
module NFLTeams
|
4
|
+
def self.all
|
5
|
+
NFLTeams::Data::TEAMS
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.full_names
|
9
|
+
NFLTeams::Data::TEAMS.map { |t| "#{t[:location]} #{t[:name]}" }
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.abbreviation(location_or_name)
|
13
|
+
team_by_name = NFLTeams::Data::TEAMS.find { |t| t[:name] == location_or_name }
|
14
|
+
|
15
|
+
return team_by_name[:abbreviation] if team_by_name
|
16
|
+
|
17
|
+
teams_by_location = NFLTeams::Data::TEAMS.find_all { |t| t[:location] == location_or_name }
|
18
|
+
abbrv_location = teams_by_location.map { |t| t[:abbreviation] }
|
19
|
+
|
20
|
+
return abbrv_location.first if abbrv_location.size == 1
|
21
|
+
return abbrv_location if abbrv_location.size > 1
|
22
|
+
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
data/nfl-teams.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'nfl-teams'
|
5
|
+
s.platform = Gem::Platform::RUBY
|
6
|
+
s.version = '0.0.1'
|
7
|
+
s.summary = 'NFL team names, locations, and abbreviations.'
|
8
|
+
s.description = 'A simple library containing team name information about current NFL teams.'
|
9
|
+
s.authors = ['Robert Peterson']
|
10
|
+
s.email = 'robertpeterson@gmail.com'
|
11
|
+
s.files = Dir['lib/**/*'] + ['README.md', 'nfl-teams.gemspec']
|
12
|
+
s.test_files = s.files.select { |p| p =~ /^test\/.*_test.rb/ }
|
13
|
+
s.homepage = 'https://github.com/rawburt/nfl-teams'
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nfl-teams
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Peterson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple library containing team name information about current NFL teams.
|
14
|
+
email: robertpeterson@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- README.md
|
20
|
+
- lib/nfl_teams.rb
|
21
|
+
- lib/nfl_teams/data.rb
|
22
|
+
- nfl-teams.gemspec
|
23
|
+
homepage: https://github.com/rawburt/nfl-teams
|
24
|
+
licenses: []
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.7.3
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: NFL team names, locations, and abbreviations.
|
46
|
+
test_files: []
|