celly 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/Gemfile.lock +2 -2
- data/celly.gemspec +1 -1
- data/lib/celly.rb +2 -0
- data/lib/celly/schedule.rb +34 -0
- data/lib/celly/standings.rb +20 -0
- data/lib/celly/team.rb +33 -5
- data/lib/celly/version.rb +1 -1
- metadata +5 -4
- data/celly-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: defce80b6f8f4835435a0d6dbf86396bc2184be90cc9eca21466e1229e71c73f
|
4
|
+
data.tar.gz: ddb9321d54da80e9c20374c6f0aca77056f5bef29079da8ebb689dc48b22cf30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5f2ea335dab3c69ed9cf66f40c4750d29c34e766ad0a518e379760037b7728a2bb2d2561f9d699bb6a17eedab16a4549c095f2230475bbd7719428d18ce54c2
|
7
|
+
data.tar.gz: 17a921d58951fd77dc36cc8014a10ed64066e62cc56ca214aeeacdc5dbca9327cc98214e412ee0b24cac7b47c31298d946ae05ddb923d0d98176e88e94479b3c
|
data/Gemfile.lock
CHANGED
data/celly.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/rymcmahon/celly"
|
19
|
-
spec.metadata["changelog_uri"] = "https://github.com/rymcmahon/celly"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/rymcmahon/celly/CHANGELOG.md"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
data/lib/celly.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Celly::Schedule
|
5
|
+
BASE_URL = 'https://statsapi.web.nhl.com/api/v1'
|
6
|
+
|
7
|
+
def all(start_date, end_date)
|
8
|
+
end_point = "/schedule?startDate=#{start_date}&endDate=#{end_date}"
|
9
|
+
uri = URI("#{BASE_URL}#{end_point}")
|
10
|
+
response = Net::HTTP.get_response(uri)
|
11
|
+
|
12
|
+
if response.code == '200'
|
13
|
+
json_response = JSON.parse(response.body)
|
14
|
+
|
15
|
+
{status: response.code, message: response.message, data: json_response["dates"]}
|
16
|
+
else
|
17
|
+
{ status: response.code, message: response.message }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def team(start_date, end_date, team_id)
|
22
|
+
end_point = "/schedule?startDate=#{start_date}&endDate=#{end_date}&teamId=#{team_id}"
|
23
|
+
uri = URI("#{BASE_URL}#{end_point}")
|
24
|
+
response = Net::HTTP.get_response(uri)
|
25
|
+
|
26
|
+
if response.code == '200'
|
27
|
+
json_response = JSON.parse(response.body)
|
28
|
+
|
29
|
+
{status: response.code, message: response.message, data: json_response["dates"]}
|
30
|
+
else
|
31
|
+
{ status: response.code, message: response.message }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Celly::Standings
|
5
|
+
BASE_URL = 'https://statsapi.web.nhl.com/api/v1'
|
6
|
+
|
7
|
+
def overall(season)
|
8
|
+
end_point = "/standings?#{season}"
|
9
|
+
uri = URI("#{BASE_URL}#{end_point}")
|
10
|
+
response = Net::HTTP.get_response(uri)
|
11
|
+
|
12
|
+
if response.code == '200'
|
13
|
+
json_response = JSON.parse(response.body)
|
14
|
+
|
15
|
+
{status: response.code, message: response.message, data: json_response["records"]}
|
16
|
+
else
|
17
|
+
{status: response.code, message: response.message}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/celly/team.rb
CHANGED
@@ -4,6 +4,20 @@ require 'json'
|
|
4
4
|
class Celly::Team
|
5
5
|
BASE_URL = 'https://statsapi.web.nhl.com/api/v1'
|
6
6
|
|
7
|
+
def all
|
8
|
+
end_point = "/teams"
|
9
|
+
uri = URI("#{BASE_URL}#{end_point}")
|
10
|
+
response = Net::HTTP.get_response(uri)
|
11
|
+
|
12
|
+
if response.code == '200'
|
13
|
+
json_response = JSON.parse(response.body)
|
14
|
+
|
15
|
+
{status: response.code, message: response.message, data: json_response["teams"] }
|
16
|
+
else
|
17
|
+
{status: response.code, message: response.message}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
7
21
|
def roster(id)
|
8
22
|
end_point = "/teams/#{id}/roster"
|
9
23
|
uri = URI("#{BASE_URL}#{end_point}")
|
@@ -18,17 +32,31 @@ class Celly::Team
|
|
18
32
|
end
|
19
33
|
end
|
20
34
|
|
21
|
-
def
|
22
|
-
end_point = "/
|
35
|
+
def find(id)
|
36
|
+
end_point = "/teams/#{id}"
|
37
|
+
uri = URI("#{BASE_URL}#{end_point}")
|
38
|
+
response = Net::HTTP.get_response(uri)
|
39
|
+
|
40
|
+
if response.code == '200'
|
41
|
+
json_response = JSON.parse(response.body)
|
42
|
+
|
43
|
+
{status: response.code, message: response.message, data: json_response["teams"]}
|
44
|
+
else
|
45
|
+
{status: response.code, message: response.message}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def stats(id)
|
50
|
+
end_point = "/teams/#{id}/stats"
|
23
51
|
uri = URI("#{BASE_URL}#{end_point}")
|
24
52
|
response = Net::HTTP.get_response(uri)
|
25
53
|
|
26
54
|
if response.code == '200'
|
27
55
|
json_response = JSON.parse(response.body)
|
28
|
-
|
29
|
-
{status: response.code, message: response.message, data: json_response["
|
56
|
+
|
57
|
+
{status: response.code, message: response.message, data: json_response["stats"]}
|
30
58
|
else
|
31
|
-
{
|
59
|
+
{status: response.code, message: response.message}
|
32
60
|
end
|
33
61
|
end
|
34
62
|
end
|
data/lib/celly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celly
|
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
|
- rymcmahon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem provides an easy-to-use DSL for retrieving player and team statistics
|
14
14
|
from the National Hockey League's API. Simple methods calls will give access to
|
@@ -30,10 +30,11 @@ files:
|
|
30
30
|
- Rakefile
|
31
31
|
- bin/console
|
32
32
|
- bin/setup
|
33
|
-
- celly-0.1.0.gem
|
34
33
|
- celly.gemspec
|
35
34
|
- lib/celly.rb
|
36
35
|
- lib/celly/player.rb
|
36
|
+
- lib/celly/schedule.rb
|
37
|
+
- lib/celly/standings.rb
|
37
38
|
- lib/celly/team.rb
|
38
39
|
- lib/celly/version.rb
|
39
40
|
homepage: https://github.com/rymcmahon/celly
|
@@ -43,7 +44,7 @@ metadata:
|
|
43
44
|
allowed_push_host: https://rubygems.org
|
44
45
|
homepage_uri: https://github.com/rymcmahon/celly
|
45
46
|
source_code_uri: https://github.com/rymcmahon/celly
|
46
|
-
changelog_uri: https://github.com/rymcmahon/celly
|
47
|
+
changelog_uri: https://github.com/rymcmahon/celly/CHANGELOG.md
|
47
48
|
post_install_message:
|
48
49
|
rdoc_options: []
|
49
50
|
require_paths:
|
data/celly-0.1.0.gem
DELETED
Binary file
|