espn_nba_fantasy 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: 8af37d5a1de02fb8468cefc41d985f509e0093e8b0c8463785f6142d869e3435
4
- data.tar.gz: 8437fad4fa2f5cca09c90a35672a59299f5272d975f406d9edcfc56f3939ea73
3
+ metadata.gz: 4306b1e3c1b828575b2baf7c5b237c54bfc3916463f84170a054c13dcd3d1dba
4
+ data.tar.gz: 833f12b70aabf99b9365ac334924b612dd9b0e71603f69d7305091d68fedb140
5
5
  SHA512:
6
- metadata.gz: f108b5042c9c293a39b9024525d78d46dbf55141a71b6fc70cacfa577ad3a8ca04c2fad6243a735c90a68979598e622321787af53b248d5f49c79c76f0bcf6ec
7
- data.tar.gz: ddd3beaea91b74251b6dd7802d779a1421aa683cddd1ee706598ef11c00c1e4df2679aa6b21e3f65446003421b5634e08cdd292b3ab3024c749ae9929f7e04ba
6
+ metadata.gz: 88b1dcadb34024a8bf8d42c572fcea180fe3167370bda2dcb2a76a538c1014a1502e03feece0c95b504e04c054b9b3c91e26a2c19ffca9dfc80e9f838f1cdfd6
7
+ data.tar.gz: feab0635a4fae468d362e316ac791d0410066c0889170babccf94632210e021527ef25130bb40bb073c1698135b4a4ca83741f86333af31bb31771d2c9220be7
@@ -13,13 +13,19 @@ class League
13
13
  #initializes the league
14
14
 
15
15
  def initialize(league_id, year, s2, sw)
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"
16
+ @league_id = league_id
17
+
18
+ @uri = "https://lm-api-reads.fantasy.espn.com/apis/v3/games/fba/seasons/#{year}/segments/0/leagues/#{league_id}?view=mRoster&view=mSettings&view=mTeam&view=modular&view=mNav"
17
19
  @cookies = {'espn_s2': "#{s2}", 'SWID': "#{sw}"}
18
20
  @data = JSON.parse(RestClient.get(@uri, {cookies: @cookies}))
19
21
  @teams = make_team_objects
20
22
  @stat_data = make_stat_data
21
23
  end
22
24
 
25
+ def to_s
26
+ "League #{@league_id}"
27
+ end
28
+
23
29
  #gives you an array of each team's name and id in the league
24
30
 
25
31
  def team_list
@@ -17,12 +17,12 @@ class Player
17
17
  @team = team
18
18
  end
19
19
 
20
- private
21
-
22
20
  def to_s
23
21
  "Player: #{name} | Position: #{position} | Stats: #{stats}"
24
22
  end
25
23
 
24
+ private
25
+
26
26
  def stat_card_maker(player)
27
27
  avgstats = player['stats'].first['averageStats']
28
28
  statcard = avgstats ? avgstats.transform_keys!{ |k| STATS_MAP[k] }.slice(*STATS) : EMPTY_STATS
@@ -27,6 +27,10 @@ class Team
27
27
  #returns data including the players trading away and receiving, your stats before and after the trade, and your
28
28
  #change in stats for each category
29
29
 
30
+ def to_s
31
+ "Team Name: #{name} | Roster: #{roster_names}"
32
+ end
33
+
30
34
  def trade_players(to_trade = [], to_receive = [], other_team_name)
31
35
  other_team = league.teams.select{|team| team.name == other_team_name}.first
32
36
  return "No team named #{other_team_name}" unless other_team
@@ -40,10 +44,6 @@ class Team
40
44
 
41
45
  private
42
46
 
43
- def to_s
44
- "Team Name: #{name} | Roster: #{roster_names}"
45
- end
46
-
47
47
  def roster_names
48
48
  players.map(&:name)
49
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: espn_nba_fantasy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Usborn Ocampo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-18 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 3.4.20
116
+ rubygems_version: 3.5.13
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Get info from your ESPN NBA Fantasy League as JSON data