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

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

Find shots for a given player

Parameters:

  • (String/Integer)

Returns:



49
50
51
52
# File 'lib/dribble/player.rb', line 49

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

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

Following Shots

Parameters:

  • (String/Integer)

Returns:



62
63
64
65
# File 'lib/dribble/player.rb', line 62

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:



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

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