espn_nba_fantasy 0.0.0 → 0.0.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: 95c1266ad0e17fe8005d0a2ae6d4c708d96f2a3bc32f552e8e7e982a8a7094a9
4
- data.tar.gz: 3e4850b64d6045defc7f213930a6826437c665e1867e2c9f194562ed1323c14f
3
+ metadata.gz: e10a33d89f8e7cb3a06c22e12d45324bfba6b7da1326d43e09b08033622d82ae
4
+ data.tar.gz: 6b2f19b1bc8dc20355f80058c5ce65a984cc6d3cf667cc1eb015320a7b4a8438
5
5
  SHA512:
6
- metadata.gz: a4c6f37cc975b0b7098f4a5a7c59c4fd6788e90fd2db4d14c079d3db59dba9644273f08ddf8034b042c26e86871ddaf7b44fed3b781bd66de9e5953e90b2557b
7
- data.tar.gz: 4ab893440cdd0c8fa580e6247949e4b4dfead8543469d1d94a9275dc6bab25f7e6017797f929a3957a7fdd9c56f17916ebc8467b4b3b56029d2d6f96ceb79ff4
6
+ metadata.gz: b5c07c8c7a3f1f9b957c7a17ae0114cf7151a47256db4d1b86b8ab050e80587c5313f6ae62e29d2d3e1ceec91564a911280f1fd10140015dcb8760a9d0634a7d
7
+ data.tar.gz: d682e892cb1d1be1e559f97eece81b9bf4c9cda74b9a19138d5f38cb2a5b6a1660f802843dd09d2682137d0223366906954b11645b53c860c6e10b130c2660f9
@@ -1,3 +1,5 @@
1
+ #this is a module used to calculate the AFG%, A/TO, and FT% stats based on existing raw stats
2
+
1
3
  module CalculateStats
2
4
 
3
5
  def add_calculated_stats(stats)
@@ -10,6 +10,8 @@ class League
10
10
 
11
11
  attr_accessor :teams, :stat_data
12
12
 
13
+ #initializes the league
14
+
13
15
  def initialize(league_id, year, s2, sw)
14
16
  @uri = "https://fantasy.espn.com/apis/v3/games/fba/seasons/#{year}/segments/0/leagues/#{league_id}?view=mTeam&view=mRoster&view=mMatchup&view=mSettings&view=mStandings"
15
17
  @cookies = {'espn_s2': "#{s2}", 'SWID': "#{sw}"}
@@ -18,10 +20,14 @@ class League
18
20
  @stat_data = make_stat_data
19
21
  end
20
22
 
23
+ #gives you an array of each team's name and id in the league
24
+
21
25
  def team_list
22
26
  @teams.map{|r| [r.name, r.team_id]}
23
27
  end
24
28
 
29
+ #pull up a Player object based on their name and their team
30
+
25
31
  def findplayer(team_name, str)
26
32
  team = teams.select{|t| t.name == team_name}.first
27
33
  return "No team named #{team_name}" unless team
@@ -7,6 +7,8 @@ class Player
7
7
 
8
8
  attr_reader :name, :player_id, :position, :stats, :team
9
9
 
10
+ #basic initialization with attributes
11
+
10
12
  def initialize(player, team)
11
13
  @name = player['fullName']
12
14
  @player_id = player['id']
@@ -1,3 +1,5 @@
1
+ #finds player given the roster (as "arr") and name (as "matcher")
2
+
1
3
  module PlayerFinder
2
4
 
3
5
  def find_players(arr, matcher)
@@ -10,6 +10,8 @@ class Team
10
10
 
11
11
  attr_accessor :roster, :players, :name, :teamstats, :league, :team_id
12
12
 
13
+ #basic initialization with the various attributes
14
+
13
15
  def initialize(obj, league)
14
16
  @name = obj['name']
15
17
  @team_id = obj['id']
@@ -19,6 +21,12 @@ class Team
19
21
  @league = league
20
22
  end
21
23
 
24
+ #method that lets you input who you're trading (Array of names), who you're receiving (Array of names),
25
+ #and what team you're trading with (String).
26
+
27
+ #returns data including the players trading away and receiving, your stats before and after the trade, and your
28
+ #change in stats for each category
29
+
22
30
  def trade_players(to_trade = [], to_receive = [], other_team_name)
23
31
  other_team = league.teams.select{|team| team.name == other_team_name}.first
24
32
  return "No team named #{other_team_name}" unless other_team
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: espn_nba_fantasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Usborn Ocampo
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-06-22 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: A way to get your league, team, and player information from your ESPN
14
28
  NBA Fantasy League
15
29
  email: usborn116@gmail.com
@@ -45,6 +59,5 @@ requirements: []
45
59
  rubygems_version: 3.4.14
46
60
  signing_key:
47
61
  specification_version: 4
48
- summary: A way to get your league, team, and player information from your ESPN NBA
49
- Fantasy League
62
+ summary: Get info from your ESPN NBA Fantasy League as JSON data
50
63
  test_files: []