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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dffec1b6fd49a14de7dc559c5c40e2a36d20180ff33cf4b1a16e5a89a62e7c8
4
- data.tar.gz: 32ca767355e8512649403796e7cb71616ea102692dc46c6882c325d9621b12f2
3
+ metadata.gz: defce80b6f8f4835435a0d6dbf86396bc2184be90cc9eca21466e1229e71c73f
4
+ data.tar.gz: ddb9321d54da80e9c20374c6f0aca77056f5bef29079da8ebb689dc48b22cf30
5
5
  SHA512:
6
- metadata.gz: 1d79d0f89bcda3071996494467e26eeff47941afd009f35bf95554e22bc0f2332e11467154d82fff0702e31ba33a381f0f2a23409932488639848c26c4510186
7
- data.tar.gz: 32c96e020576923604073bcec57be8ece1ffba2b9526e874a1e4c7b5d121421c99b8c33abb48f7d4dc0497aed28865db9d103249fabbd81edbc81651d0451c1e
6
+ metadata.gz: f5f2ea335dab3c69ed9cf66f40c4750d29c34e766ad0a518e379760037b7728a2bb2d2561f9d699bb6a17eedab16a4549c095f2230475bbd7719428d18ce54c2
7
+ data.tar.gz: 17a921d58951fd77dc36cc8014a10ed64066e62cc56ca214aeeacdc5dbca9327cc98214e412ee0b24cac7b47c31298d946ae05ddb923d0d98176e88e94479b3c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- celly (0.1.0)
4
+ celly (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -31,4 +31,4 @@ DEPENDENCIES
31
31
  rspec (~> 3.0)
32
32
 
33
33
  BUNDLED WITH
34
- 2.1.2
34
+ 2.2.10
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
@@ -1,6 +1,8 @@
1
1
  require "celly/version"
2
2
  require "celly/player"
3
3
  require "celly/team"
4
+ require "celly/schedule"
5
+ require "celly/standings"
4
6
 
5
7
  module Celly
6
8
  class Error < StandardError; end
@@ -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 schedule(start_date, end_date, team_id)
22
- end_point = "/schedule?startDate=#{start_date}&endDate=#{end_date}&teamId=#{team_id}"
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["dates"]}
56
+
57
+ {status: response.code, message: response.message, data: json_response["stats"]}
30
58
  else
31
- { status: response.code, message: response.message }
59
+ {status: response.code, message: response.message}
32
60
  end
33
61
  end
34
62
  end
data/lib/celly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Celly
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-22 00:00:00.000000000 Z
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