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.



11
12
13
14
15
# File 'lib/dribble/player.rb', line 11

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

#comments_countObject (readonly)

Returns the value of attribute comments_count.



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

def comments_count
  @comments_count
end

#comments_received_countObject (readonly)

Returns the value of attribute comments_received_count.



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

def comments_received_count
  @comments_received_count
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

#followingObject (readonly)

Returns the value of attribute following.



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

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

#likes_countObject (readonly)

Returns the value of attribute likes_count.



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

def likes_count
  @likes_count
end

#likes_receive_countObject (readonly)

Returns the value of attribute likes_receive_count.



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

def likes_receive_count
  @likes_receive_count
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

#pageObject (readonly)

Returns the value of attribute page.



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

def page
  @page
end

#pagesObject (readonly)

Returns the value of attribute pages.



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

def pages
  @pages
end

#per_pageObject (readonly)

Returns the value of attribute per_page.



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

def per_page
  @per_page
end

#playersObject (readonly)

Returns the value of attribute players.



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

def players
  @players
end

#rebounds_countObject (readonly)

Returns the value of attribute rebounds_count.



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

def rebounds_count
  @rebounds_count
end

#rebounds_received_countObject (readonly)

Returns the value of attribute rebounds_received_count.



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

def rebounds_received_count
  @rebounds_received_count
end

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

Player’s Shots

Parameters:

Returns:

  • (Array)


37
38
39
# File 'lib/dribble/player.rb', line 37

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

#totalObject (readonly)

Returns the value of attribute total.



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

def total
  @total
end

#twitter_screen_nameObject (readonly)

Returns the value of attribute twitter_screen_name.



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

def twitter_screen_name
  @twitter_screen_name
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:



116
117
118
119
# File 'lib/dribble/player.rb', line 116

def draftees(id, options={})
  results = Dribble::API::Player.draftees(id, options)
  Dribble::Draftees.new(format_players(results), results.merge(:player_name => id))
end

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

Find shots for a given player

Parameters:

  • (String/Integer)

Returns:



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

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

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

Followers

Parameters:

  • (String/Integer)

Returns:



102
103
104
105
106
# File 'lib/dribble/player.rb', line 102

def followers(id, options={})
  puts "ID: #{id} OPTIONS: #{options.inspect}"
  results = Dribble::API::Player.followers(id, options)
  Dribble::Followers.new(format_players(results), results.merge(:player_name => id))
end

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

Following Shots

Parameters:

  • (String/Integer)

Returns:



89
90
91
92
# File 'lib/dribble/player.rb', line 89

def following_shots(id, options={})
  results = Dribble::API::Player.following_shots(id, options)
  Dribble::Following.new(format_shots(results), results.merge(:player_name => id))
end

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

Profile

Parameters:

  • (String/Integer)

Returns:



129
130
131
# File 'lib/dribble/player.rb', line 129

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

Instance Method Details

#draftees(options = {}) ⇒ Array

Player’s Shots

Parameters:

Returns:

  • (Array)


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

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

#followers(options = {}) ⇒ Array

Player’s Shots

Parameters:

Returns:

  • (Array)


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

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

#following_shots(options = {}) ⇒ Array

Following shots

Parameters:

Returns:

  • (Array)


25
26
27
# File 'lib/dribble/player.rb', line 25

def following_shots(options={})
  @following ||= Dribble::API::Shot.following(self.id, options)
end