nhl_stats 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4754e1a9e0ecd04c5f06cbcf240234e365e335c089b4737fd0a54b762956e7ba
4
- data.tar.gz: 5d68b5d523a585ce03ea2b6f07a15a07870d2e9e3aee390b2c312d3fa21a3cfa
3
+ metadata.gz: eea5a2eabf74a58c3270543874bb3cb8e7fa5759e9dd93c0fe101260bc130bdc
4
+ data.tar.gz: 64b9935fb562ca3b9120c04f4272a9926b1d94e96f08dea58974a5473f0c4036
5
5
  SHA512:
6
- metadata.gz: f96380dae1725d572dd788726e528cbccf75f005f3cfa712d59021235817a61d3dd90fbe89b1093fb35e444e3f835ab0518a21336da4cf93ce1180fb2594ca71
7
- data.tar.gz: b84f054d0ade94e70368b550214244aaa1dfe6a918b95cc0cce87a2e28dbba2a4d2f20e6a9e08d52f9c8b898c51ad7d32befc72803442227e14bc674ad47eceb
6
+ metadata.gz: 41db206649975a2b84b3fe8516b944212c52c4774c27accff35cf7d9bc33851121420fe5dc9249cf6ad5dcec9744d0016be75fc57ecfabf84b7d5be3ff686db3
7
+ data.tar.gz: 0760f7a5cf485ac5b6a63fa9255ba8d31287003589f15c03ad03ce61722900c44e5222de0ebed5477fece6d6f209252b22eb42c8c1bf3e1bb71cf570d838b487
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nhl_stats (0.1.0)
4
+ nhl_stats (0.1.1)
5
5
  faraday (~> 0.15.4)
6
6
  json (~> 2.2.0)
7
7
 
data/lib/nhl_stats.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require "nhl_stats/version"
2
+ require "nhl_stats/conference"
3
+ require "nhl_stats/division"
2
4
  require "nhl_stats/game"
3
5
  require "nhl_stats/player"
4
6
  require "nhl_stats/team"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module NHLStats
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
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 = "Gem wrapping the undocumented NHL stats API"
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://shrugguy.com"
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.0
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-08 00:00:00.000000000 Z
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: Gem wrapping the undocumented NHL stats API
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://shrugguy.com
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.4
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