Class: Yt::Models::StatisticsSet

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/statistics_set.rb

Overview

Encapsulates statistics about the resource, such as the number of times the resource has been viewed or liked.

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ StatisticsSet

Returns a new instance of StatisticsSet.



10
11
12
# File 'lib/yt/models/statistics_set.rb', line 10

def initialize(options = {})
  @data = options[:data]
end

Instance Method Details

#comment_countInteger

Returns the number of comments for the resource.

Returns:

  • (Integer)

    the number of comments for the resource.



20
21
22
# File 'lib/yt/models/statistics_set.rb', line 20

def comment_count
  @comment_count ||= @data['commentCount'].to_i
end

#dislike_countInteger

Returns the number of users who disliked the resource.

Returns:

  • (Integer)

    the number of users who disliked the resource.



30
31
32
# File 'lib/yt/models/statistics_set.rb', line 30

def dislike_count
  @dislike_count ||= @data['dislikeCount'].to_i
end

#favorite_countInteger

Returns the number of users who currently have the resource marked as a favorite resource.

Returns:

  • (Integer)

    the number of users who currently have the resource marked as a favorite resource.



36
37
38
# File 'lib/yt/models/statistics_set.rb', line 36

def favorite_count
  @favorite_count ||= @data['favoriteCount'].to_i
end

#like_countInteger

Returns the number of users who liked the resource.

Returns:

  • (Integer)

    the number of users who liked the resource.



25
26
27
# File 'lib/yt/models/statistics_set.rb', line 25

def like_count
  @like_count ||= @data['likeCount'].to_i
end

#subscriber_countInteger

Returns the number of subscriber the resource has.

Returns:

  • (Integer)

    the number of subscriber the resource has.



46
47
48
# File 'lib/yt/models/statistics_set.rb', line 46

def subscriber_count
  @subscriber_count ||= @data['subscriberCount'].to_i
end

#subscriber_count_visible?Boolean

Returns whether the number of subscribers is publicly visible.

Returns:

  • (Boolean)

    whether the number of subscribers is publicly visible.



51
52
53
# File 'lib/yt/models/statistics_set.rb', line 51

def subscriber_count_visible?
  @subscriber_count_visible ||= @data['hiddenSubscriberCount'] == false
end

#video_countInteger

Returns the number of videos updated to the resource.

Returns:

  • (Integer)

    the number of videos updated to the resource.



41
42
43
# File 'lib/yt/models/statistics_set.rb', line 41

def video_count
  @video_count ||= @data['videoCount'].to_i
end

#view_countInteger

Returns the number of times the resource has been viewed.

Returns:

  • (Integer)

    the number of times the resource has been viewed.



15
16
17
# File 'lib/yt/models/statistics_set.rb', line 15

def view_count
  @view_count ||= @data['viewCount'].to_i
end