sportradar-api 0.1.35 → 0.1.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a061e65faeebe5ef70054783d4ed2518110e99fd
4
- data.tar.gz: 4bf69f6ee6700d7b855931857da2c48db83f16d6
3
+ metadata.gz: ca09d1345e62f293f9d60bdd94130b228d75eb74
4
+ data.tar.gz: e956f6aabd92db91b1d76fc416d98e08b4c99e9b
5
5
  SHA512:
6
- metadata.gz: ed404102e62d75c4466ac437122f9a0b1cc85550e3bd78484b3c9c643014149c799fe4596b53b426c57ebdc8be8aca865508df8b79255a6843c1ef836c34064c
7
- data.tar.gz: 4ffc865858660687a8528cb5486d3de9a3a537ca938da9744f1fd2872e78a5f27052d72fa42ecd9dc6073c32d64fc52404a2d2a1dcb8a96a07b84246892bed70
6
+ metadata.gz: 20da3ed3414475195779ffe7833181c2a98a7cd3d363bdec0174f861fc99c146438067431d80669fb0c038e98d7577d556f2ed8e13cd2115391d9bb3def76e86
7
+ data.tar.gz: 6b233f24099da61879525aaa37e5f2b8223e4b5650ac3c9a2faf1748c56190a4df74a8a908923f02e6e1c8d09188fbb1a432984762c1d54a8c5212e403f35e3e
@@ -1,6 +1,7 @@
1
1
  module Sportradar
2
2
  module Api
3
3
  class Nfl::DepthChart < Data
4
+ include Enumerable
4
5
  attr_accessor :response, :chart
5
6
 
6
7
  def initialize(data)
@@ -10,6 +11,10 @@ module Sportradar
10
11
  def team(number)
11
12
  teams[number]
12
13
  end
14
+ def each
15
+ populate_teams
16
+ teams.each { |team| yield team }
17
+ end
13
18
 
14
19
  private
15
20
 
@@ -17,6 +22,10 @@ module Sportradar
17
22
  @teams ||= Hash.new { |hash, number| hash[number] = generate_team(number) }
18
23
  end
19
24
 
25
+ def populate_teams
26
+ (1..3).each(&method(:team)) if teams.empty?
27
+ end
28
+
20
29
  def generate_team(number)
21
30
  @chart.each_with_object({}) do |(pos_name, groups), memo|
22
31
  memo[pos_name] = groups[number.to_s]
@@ -1,6 +1,7 @@
1
1
  module Sportradar
2
2
  module Api
3
3
  class Nfl::LeagueDepthChart < Data
4
+ include Enumerable
4
5
  attr_accessor :response, :season, :charts
5
6
 
6
7
  def initialize(data)
@@ -19,6 +20,10 @@ module Sportradar
19
20
  @charts.detect { |chart| chart.team_id == id || chart.abbrev == abbrev }
20
21
  end
21
22
 
23
+ def each
24
+ self.charts.each { |chart| yield chart }
25
+ end
26
+
22
27
  end
23
28
  end
24
29
  end
@@ -1,7 +1,7 @@
1
1
  module Sportradar
2
2
  module Api
3
3
  class Nfl::Team < Data
4
- attr_accessor :response, :id, :name, :alias, :game_number, :defense, :special_teams, :offense, :players, :statistics, :team_records, :player_records, :market, :franchise, :venue, :hierarchy, :coaches, :players, :used_timeouts, :remaining_timeouts, :points, :wins, :losses, :ties, :win_pct, :rank, :stats
4
+ attr_accessor :response, :id, :name, :alias, :game_number, :defense, :special_teams, :offense, :players, :statistics, :team_records, :player_records, :market, :franchise, :venue, :hierarchy, :coaches, :players, :used_timeouts, :remaining_timeouts, :points, :wins, :losses, :ties, :win_pct, :rank, :stats, :depth_chart
5
5
 
6
6
  alias_method :score, :points
7
7
 
@@ -1,6 +1,7 @@
1
1
  module Sportradar
2
2
  module Api
3
3
  class Nfl::TeamDepthChart < Data
4
+ include Enumerable
4
5
  attr_accessor :response, :season, :team_id, :abbrev
5
6
 
6
7
  # data.keys => ["offense", "defense", "special_teams", "name", "market", "alias", "id"]
@@ -27,6 +28,10 @@ module Sportradar
27
28
  @team ||= Sportradar::Api::Nfl::Team.new(response).tap { |team| team.depth_chart = self }
28
29
  end
29
30
 
31
+ def each
32
+ [:offense, :defense, :special_teams].each { |type| yield type, send(type) }
33
+ end
34
+
30
35
  private
31
36
 
32
37
  def set_charts
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.1.35"
3
+ VERSION = "0.1.36"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett