Class: Dribble::Player

Inherits:
Object show all
Defined in:
lib/dribble/player.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attr = {}) ⇒ Player

Returns a new instance of Player.



8
9
10
11
12
# File 'lib/dribble/player.rb', line 8

def initialize(attr={})
  attr.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#avatar_urlObject (readonly)

Returns the value of attribute avatar_url.



3
4
5
# File 'lib/dribble/player.rb', line 3

def avatar_url
  @avatar_url
end

#created_atObject (readonly)

Returns the value of attribute created_at.



3
4
5
# File 'lib/dribble/player.rb', line 3

def created_at
  @created_at
end

#drafted_by_player_idObject (readonly)

Returns the value of attribute drafted_by_player_id.



3
4
5
# File 'lib/dribble/player.rb', line 3

def drafted_by_player_id
  @drafted_by_player_id
end

#draftees_countObject (readonly)

Returns the value of attribute draftees_count.



3
4
5
# File 'lib/dribble/player.rb', line 3

def draftees_count
  @draftees_count
end

#followers_countObject (readonly)

Returns the value of attribute followers_count.



3
4
5
# File 'lib/dribble/player.rb', line 3

def followers_count
  @followers_count
end

#following(options = {}) ⇒ Array (readonly)

Following

Parameters:

Returns:

  • (Array)


22
23
24
# File 'lib/dribble/player.rb', line 22

def following
  @following
end

#following_countObject (readonly)

Returns the value of attribute following_count.



3
4
5
# File 'lib/dribble/player.rb', line 3

def following_count
  @following_count
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/dribble/player.rb', line 3

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/dribble/player.rb', line 3

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/dribble/player.rb', line 3

def name
  @name
end

#shots(options = {}) ⇒ Array (readonly)

Player’s Shots

Parameters:

Returns:

  • (Array)


34
35
36
# File 'lib/dribble/player.rb', line 34

def shots
  @shots
end

#shots_countObject (readonly)

Returns the value of attribute shots_count.



3
4
5
# File 'lib/dribble/player.rb', line 3

def shots_count
  @shots_count
end

#urlObject (readonly)

Returns the value of attribute url.



3
4
5
# File 'lib/dribble/player.rb', line 3

def url
  @url
end

Class Method Details

.draftees(id, options = {}) ⇒ Object

Draftees

Parameters:

  • (String/Integer)

Returns:



112
113
114
115
# File 'lib/dribble/player.rb', line 112

def draftees(id, options={})
  results = Dribble::API::Player.draftees(id, options)
  Dribble::Players.new(format_players(results), results)
end

.find_shots(id, options = {}) ⇒ Object

Find shots for a given player

Parameters:

  • (String/Integer)

Returns:



73
74
75
76
# File 'lib/dribble/player.rb', line 73

def find_shots(id, options={})
  results = Dribble::API::Player.find_shots(id, options)
  Dribble::Shots.new(format_shots(results), results)
end

.followers(id, options = {}) ⇒ Object

Followers

Parameters:

  • (String/Integer)

Returns:



99
100
101
102
# File 'lib/dribble/player.rb', line 99

def followers(id, options={})
  results = Dribble::API::Player.followers(id, options)
  Dribble::Players.new(format_players(results), results)
end

.following_shots(id, options = {}) ⇒ Object

Following Shots

Parameters:

  • (String/Integer)

Returns:



86
87
88
89
# File 'lib/dribble/player.rb', line 86

def following_shots(id, options={})
  results = Dribble::API::Player.following_shots(id, options)
  Dribble::Shots.new(format_shots(results), results)
end

.profile(id) ⇒ Object Also known as: find

Profile

Parameters:

  • (String/Integer)

Returns:



125
126
127
# File 'lib/dribble/player.rb', line 125

def profile(id)
  new(Dribble::API::Player.profile(id))
end

Instance Method Details

#draftees(options = {}) ⇒ Array

Player’s Shots

Parameters:

Returns:

  • (Array)


46
47
48
# File 'lib/dribble/player.rb', line 46

def draftees(options={})
  @draftees ||= Dribble::API::Player.draftees(self.id, options)
end

#followers(options = {}) ⇒ Array

Player’s Shots

Parameters:

Returns:

  • (Array)


58
59
60
# File 'lib/dribble/player.rb', line 58

def followers(options={})
  @followers ||= Dribble::API::Player.followers(self.id, options)
end