Class: YFantasy::Player

Inherits:
BaseResource show all
Defined in:
lib/y_fantasy/resources/player.rb,
lib/y_fantasy/resources/player/draft_analysis.rb,
lib/y_fantasy/resources/player/stat_collection.rb,
lib/y_fantasy/resources/player/ownership_percentage.rb

Overview

Represents a Yahoo Fantasy Player

Defined Under Namespace

Classes: DraftAnalysis, OwnershipPercentage, StatCollection

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

collection_name, dependent?, find, find_all, #key, resource_name

Methods included from Subresourceable

included

Instance Attribute Details

#bye_weeksArray<String>? (readonly)

Returns the bye weeks for this player.

Returns:

  • (Array<String>, nil)

    the bye weeks for this player



81
# File 'lib/y_fantasy/resources/player.rb', line 81

option :bye_weeks, optional: true, type: ->(h) { h[:week] }

#display_positionString (readonly)

Note:

When a player has more than one position, this will be a comma-separated string of positions

Returns the display position of the player.

Returns:

  • (String)

    the display position of the player



19
# File 'lib/y_fantasy/resources/player.rb', line 19

option :display_position

#draft_analysisDraftAnalysis? (readonly)

Returns the draft analysis for this player.

Returns:



120
# File 'lib/y_fantasy/resources/player.rb', line 120

option :draft_analysis, optional: true, type: instance_of(DraftAnalysis)

#editorial_player_keyString (readonly)

Returns the editorial key for this player.

Returns:

  • (String)

    the editorial key for this player



23
# File 'lib/y_fantasy/resources/player.rb', line 23

option :editorial_player_key

#editorial_team_abbrString (readonly)

Returns the abbreviation of the player’s real-life team.

Returns:

  • (String)

    the abbreviation of the player’s real-life team



27
# File 'lib/y_fantasy/resources/player.rb', line 27

option :editorial_team_abbr

#editorial_team_full_nameString (readonly)

Returns the full name of the player’s real-life team.

Returns:

  • (String)

    the full name of the player’s real-life team



31
# File 'lib/y_fantasy/resources/player.rb', line 31

option :editorial_team_full_name

#editorial_team_keyString (readonly)

Returns the key of the player’s real-life team.

Returns:

  • (String)

    the key of the player’s real-life team



35
# File 'lib/y_fantasy/resources/player.rb', line 35

option :editorial_team_key

#editorial_team_urlString (readonly)

Returns the URL to the player’s real-life team page.

Returns:

  • (String)

    the URL to the player’s real-life team page



39
# File 'lib/y_fantasy/resources/player.rb', line 39

option :editorial_team_url

#eligible_positionsString+ (readonly)

Returns the eligible positions for this player (e.g. “QB”, [“RB”, “WR”]).

Returns:

  • (String, Array<String>)

    the eligible positions for this player (e.g. “QB”, [“RB”, “WR”])



43
# File 'lib/y_fantasy/resources/player.rb', line 43

option :eligible_positions, type: ->(h) { h[:position] }

#has_player_notesBoolean? (readonly)

Returns whether this player has notes.

Returns:

  • (Boolean, nil)

    whether this player has notes



85
# File 'lib/y_fantasy/resources/player.rb', line 85

option :has_player_notes, optional: true, type: Types::Params::Bool

#has_recent_player_notesBoolean? (readonly)

Returns whether this player has recent notes.

Returns:

  • (Boolean, nil)

    whether this player has recent notes



89
# File 'lib/y_fantasy/resources/player.rb', line 89

option :has_recent_player_notes, optional: true, type: Types::Params::Bool

#headshotHash (readonly)

Returns hash containing headshot information (size, url).

Returns:

  • (Hash)

    hash containing headshot information (size, url)



47
# File 'lib/y_fantasy/resources/player.rb', line 47

option :headshot

#image_urlString (readonly)

Returns the player’s image URL.

Returns:

  • (String)

    the player’s image URL



51
# File 'lib/y_fantasy/resources/player.rb', line 51

option :image_url

#is_keeperHash (readonly)

Returns A hash containing the player’s keeper status and cost.

Returns:

  • (Hash)

    A hash containing the player’s keeper status and cost



55
# File 'lib/y_fantasy/resources/player.rb', line 55

option :is_keeper

#is_undroppableBoolean (readonly)

Returns whether this player is undroppable.

Returns:

  • (Boolean)

    whether this player is undroppable



59
# File 'lib/y_fantasy/resources/player.rb', line 59

option :is_undroppable, type: Types::Params::Bool

#nameHash (readonly)

Returns hash containing the player’s name (first, last, full, ascii_first, ascii_last).

Returns:

  • (Hash)

    hash containing the player’s name (first, last, full, ascii_first, ascii_last)



63
# File 'lib/y_fantasy/resources/player.rb', line 63

option :name

#ownership_percentageOwnershipPercentage? (readonly)

Returns the ownership percentage information for this player.

Returns:



124
# File 'lib/y_fantasy/resources/player.rb', line 124

option :ownership_percentage, optional: true, type: instance_of(OwnershipPercentage)

#player_idInteger (readonly)

Returns the ID for this player.

Returns:

  • (Integer)

    the ID for this player



14
# File 'lib/y_fantasy/resources/player.rb', line 14

option :player_id, type: Types::Coercible::Integer

#player_keyString (readonly)

Returns the unique key for this player, within a Game.

Returns:

  • (String)

    the unique key for this player, within a Game



10
# File 'lib/y_fantasy/resources/player.rb', line 10

option :player_key

#player_notes_last_timestampInteger? (readonly)

Returns the timestamp of the last player note.

Returns:

  • (Integer, nil)

    the timestamp of the last player note



93
# File 'lib/y_fantasy/resources/player.rb', line 93

option :player_notes_last_timestamp, optional: true, type: Types::Coercible::Integer

#player_pointsHash? (readonly)

Note:

Only available when requesting a player within a team’s roster

Hash containing details about the player’s fantasy points. Includes: coverage_type, total, week.

Returns:

  • (Hash, nil)

    the player’s fantasy points information



99
100
101
102
103
# File 'lib/y_fantasy/resources/player.rb', line 99

option :player_points, optional: true do
  option :coverage_type
  option :total, type: Types::Coercible::Float
  option :week, optional: true, type: Types::Coercible::Integer
end

#position_typeString (readonly)

Returns the type of position (e.g. “O” for offense).

Returns:

  • (String)

    the type of position (e.g. “O” for offense)



67
# File 'lib/y_fantasy/resources/player.rb', line 67

option :position_type

#selected_positionHash? (readonly)

Note:

Only available when requesting a player within a team’s roster

Hash containing details about the player’s selected position. Includes: coverage_type, is_flex, positition, week.

Returns:

  • (Hash, nil)

    the player’s selected position information



109
110
111
112
113
114
# File 'lib/y_fantasy/resources/player.rb', line 109

option :selected_position, optional: true do
  option :coverage_type
  option :is_flex, optional: true, type: Types::Params::Bool
  option :position
  option :week, optional: true, type: Types::Coercible::Integer
end

#statsStatCollection? (readonly)

Returns the stat collection for this player.

Returns:



128
# File 'lib/y_fantasy/resources/player.rb', line 128

option :stats, optional: true, type: instance_of(StatCollection)

#uniform_numberString (readonly)

Returns the player’s uniform number.

Returns:

  • (String)

    the player’s uniform number



71
# File 'lib/y_fantasy/resources/player.rb', line 71

option :uniform_number

#urlString (readonly)

Returns the URL to the player’s Yahoo Fantasy page.

Returns:

  • (String)

    the URL to the player’s Yahoo Fantasy page



75
# File 'lib/y_fantasy/resources/player.rb', line 75

option :url

Instance Method Details

#first_nameString

Returns the player’s first name

Returns:

  • (String)

    the player’s first name



140
141
142
# File 'lib/y_fantasy/resources/player.rb', line 140

def first_name
  name[:first]
end

#full_nameString

Returns the player’s full name

Returns:

  • (String)

    the player’s full name



152
153
154
# File 'lib/y_fantasy/resources/player.rb', line 152

def full_name
  name[:full]
end

#last_nameString

Returns the player’s last name

Returns:

  • (String)

    the player’s last name



146
147
148
# File 'lib/y_fantasy/resources/player.rb', line 146

def last_name
  name[:last]
end