Class: Dribble::Shot

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Shot

Returns a new instance of Shot.



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

def initialize(attributes={})
  attributes.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  @player = Dribble::Player.new(attributes[:player]) if attributes[:player]
end

Instance Attribute Details

#comments_countObject (readonly)

Returns the value of attribute comments_count.



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

def comments_count
  @comments_count
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#heightObject (readonly)

Returns the value of attribute height.



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

def height
  @height
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#image_teaser_urlObject (readonly)

Returns the value of attribute image_teaser_url.



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

def image_teaser_url
  @image_teaser_url
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



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

def image_url
  @image_url
end

#likes_countObject (readonly)

Returns the value of attribute likes_count.



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

def likes_count
  @likes_count
end

#playerObject (readonly)

Returns the value of attribute player.



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

def player
  @player
end

#rebounds_countObject (readonly)

Returns the value of attribute rebounds_count.



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

def rebounds_count
  @rebounds_count
end

#short_urlObject (readonly)

Returns the value of attribute short_url.



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

def short_url
  @short_url
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#views_countObject (readonly)

Returns the value of attribute views_count.



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

def views_count
  @views_count
end

#widthObject (readonly)

Returns the value of attribute width.



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

def width
  @width
end

Class Method Details

.debuts(options = {}) ⇒ Object

Debuts

Parameters:

  • e.g. (Hash)

    => 30, :page => 1

Returns:



65
66
67
68
# File 'lib/dribble/shot.rb', line 65

def self.debuts(options={})
  results = Dribble::API::Shot.debuts(options)
  Dribble::Debuts.new(format_shots(results), results)
end

.everyones(options = {}) ⇒ Object

Everyones

Parameters:

  • e.g. (Hash)

    => 30, :page => 1

Returns:



50
51
52
53
# File 'lib/dribble/shot.rb', line 50

def self.everyones(options={})
  results = Dribble::API::Shot.everyones(options)
  Dribble::Everyones.new(format_shots(results), results)
end

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

Following

Parameters:

  • (String/Integer)

Returns:



35
36
37
38
# File 'lib/dribble/shot.rb', line 35

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

.for(id) ⇒ Object

By ID

Parameters:

  • (Integer)

Returns:



23
24
25
# File 'lib/dribble/shot.rb', line 23

def self.for(id)
  new(Dribble::API::Shot.for(id))
end

Popular

Parameters:

  • e.g. (Hash)

    => 30, :page => 1

Returns:



80
81
82
83
# File 'lib/dribble/shot.rb', line 80

def self.popular(options={})
  results = Dribble::API::Shot.popular(options)
  Dribble::Popular.new(format_shots(results), results)
end