nhl_stats 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/nhl_stats.rb +2 -0
- data/lib/nhl_stats/conference.rb +23 -0
- data/lib/nhl_stats/division.rb +24 -0
- data/lib/nhl_stats/version.rb +1 -1
- data/nhl_stats.gemspec +2 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eea5a2eabf74a58c3270543874bb3cb8e7fa5759e9dd93c0fe101260bc130bdc
|
4
|
+
data.tar.gz: 64b9935fb562ca3b9120c04f4272a9926b1d94e96f08dea58974a5473f0c4036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41db206649975a2b84b3fe8516b944212c52c4774c27accff35cf7d9bc33851121420fe5dc9249cf6ad5dcec9744d0016be75fc57ecfabf84b7d5be3ff686db3
|
7
|
+
data.tar.gz: 0760f7a5cf485ac5b6a63fa9255ba8d31287003589f15c03ad03ce61722900c44e5222de0ebed5477fece6d6f209252b22eb42c8c1bf3e1bb71cf570d838b487
|
data/Gemfile.lock
CHANGED
data/lib/nhl_stats.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module NHLStats
|
2
|
+
class Conference
|
3
|
+
attr_reader :id, :name
|
4
|
+
|
5
|
+
def initialize(conference_data)
|
6
|
+
@id = conference_data["id"]
|
7
|
+
@name = conference_data["name"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.find(id)
|
11
|
+
response = Faraday.get("#{API_ROOT}/conferences/#{id}")
|
12
|
+
attributes = JSON.parse(response.body).dig("conferences", 0)
|
13
|
+
new(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.list
|
17
|
+
response = Faraday.get("#{API_ROOT}/conferences")
|
18
|
+
JSON.parse(response.body).
|
19
|
+
dig("conferences").
|
20
|
+
map { |c| NHLStats::Conference.new(c) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module NHLStats
|
2
|
+
class Division
|
3
|
+
attr_reader :id, :name, :abbreviation
|
4
|
+
|
5
|
+
def initialize(division_data)
|
6
|
+
@id = division_data["id"]
|
7
|
+
@name = division_data["name"]
|
8
|
+
@abbreviation = division_data["nameShort"]
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.find(id)
|
12
|
+
response = Faraday.get("#{API_ROOT}/divisions/#{id}")
|
13
|
+
attributes = JSON.parse(response.body).dig("divisions", 0)
|
14
|
+
new(attributes)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.list
|
18
|
+
response = Faraday.get("#{API_ROOT}/divisions")
|
19
|
+
JSON.parse(response.body).
|
20
|
+
dig("divisions").
|
21
|
+
map { |d| NHLStats::Division.new(d) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/nhl_stats/version.rb
CHANGED
data/nhl_stats.gemspec
CHANGED
@@ -9,12 +9,12 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["wright1@ualberta.ca"]
|
10
10
|
|
11
11
|
spec.summary = "Gem wrapping the undocumented NHL stats API"
|
12
|
-
spec.description = "
|
12
|
+
spec.description = "Wraps the undocumented NHL stats API"
|
13
13
|
spec.homepage = "https://shrugguy.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/ChaoticBoredom/nhl_stats"
|
18
18
|
spec.metadata["changelog_uri"] = "https://shrugguy.com"
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nhl_stats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Susan Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.2.0
|
41
|
-
description:
|
41
|
+
description: Wraps the undocumented NHL stats API
|
42
42
|
email:
|
43
43
|
- wright1@ualberta.ca
|
44
44
|
executables: []
|
@@ -58,6 +58,8 @@ files:
|
|
58
58
|
- bin/console
|
59
59
|
- bin/setup
|
60
60
|
- lib/nhl_stats.rb
|
61
|
+
- lib/nhl_stats/conference.rb
|
62
|
+
- lib/nhl_stats/division.rb
|
61
63
|
- lib/nhl_stats/game.rb
|
62
64
|
- lib/nhl_stats/player.rb
|
63
65
|
- lib/nhl_stats/team.rb
|
@@ -68,7 +70,7 @@ licenses:
|
|
68
70
|
- MIT
|
69
71
|
metadata:
|
70
72
|
homepage_uri: https://shrugguy.com
|
71
|
-
source_code_uri: https://
|
73
|
+
source_code_uri: https://github.com/ChaoticBoredom/nhl_stats
|
72
74
|
changelog_uri: https://shrugguy.com
|
73
75
|
post_install_message:
|
74
76
|
rdoc_options: []
|
@@ -85,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
87
|
- !ruby/object:Gem::Version
|
86
88
|
version: '0'
|
87
89
|
requirements: []
|
88
|
-
rubygems_version: 3.0.
|
90
|
+
rubygems_version: 3.0.6
|
89
91
|
signing_key:
|
90
92
|
specification_version: 4
|
91
93
|
summary: Gem wrapping the undocumented NHL stats API
|