Class: YTAnalytics::Client
- Inherits:
-
Object
- Object
- YTAnalytics::Client
- Includes:
- Logging
- Defined in:
- lib/yt_analytics/client.rb
Direct Known Subclasses
Instance Method Summary collapse
- #analytics(options = {}) ⇒ Object
- #current_user ⇒ Object
- #day_totals(options = {}) ⇒ Object
-
#day_watch_time(options = {}) ⇒ Object
WATCH TIME METRICS.
-
#demographic_percentages(options = {}) ⇒ Object
DEMOGRAPHICS METRICS.
- #enable_http_debugging ⇒ Object
-
#initialize(*params) ⇒ Client
constructor
Previously this was a logger instance but we now do it globally.
- #month_totals(options = {}) ⇒ Object
- #seven_day_totals(options = {}) ⇒ Object
- #thirty_day_totals(options = {}) ⇒ Object
Methods included from Logging
Constructor Details
#initialize(*params) ⇒ Client
Previously this was a logger instance but we now do it globally
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yt_analytics/client.rb', line 6 def initialize *params if params.first.is_a?(Hash) = params.first @user = [:username] @pass = [:password] @dev_key = [:dev_key] @client_id = [:client_id] || "yt_analytics" @legacy_debug_flag = [:debug] elsif params.first puts "* warning: the method YTAnalytics::Client.new(user, passwd, dev_key) is deprecated, use YTAnalytics::Client.new(:username => 'user', :password => 'passwd', :dev_key => 'dev_key')" @user = params.shift @pass = params.shift @dev_key = params.shift @client_id = params.shift || "youtube_it" @legacy_debug_flag = params.shift end end |
Instance Method Details
#analytics(options = {}) ⇒ Object
32 33 34 |
# File 'lib/yt_analytics/client.rb', line 32 def analytics( = {}) client.get_analytics() end |
#current_user ⇒ Object
28 29 30 |
# File 'lib/yt_analytics/client.rb', line 28 def current_user client.get_current_user end |
#day_totals(options = {}) ⇒ Object
44 45 46 |
# File 'lib/yt_analytics/client.rb', line 44 def day_totals( = {}) client.temporal_totals('day',self.user_id, ) end |
#day_watch_time(options = {}) ⇒ Object
WATCH TIME METRICS
58 59 60 |
# File 'lib/yt_analytics/client.rb', line 58 def day_watch_time( = {}) client.watch_time_metrics('day', self.user_id, ) end |
#demographic_percentages(options = {}) ⇒ Object
DEMOGRAPHICS METRICS
53 54 55 |
# File 'lib/yt_analytics/client.rb', line 53 def demographic_percentages( = {}) client.demographic_percentages(self.user_id, ) end |
#enable_http_debugging ⇒ Object
24 25 26 |
# File 'lib/yt_analytics/client.rb', line 24 def enable_http_debugging client.enable_http_debugging end |
#month_totals(options = {}) ⇒ Object
48 49 50 |
# File 'lib/yt_analytics/client.rb', line 48 def month_totals( = {}) client.temporal_totals('month',self.user_id, ) end |
#seven_day_totals(options = {}) ⇒ Object
36 37 38 |
# File 'lib/yt_analytics/client.rb', line 36 def seven_day_totals( = {}) client.temporal_totals('7DayTotals',self.user_id, ) end |
#thirty_day_totals(options = {}) ⇒ Object
40 41 42 |
# File 'lib/yt_analytics/client.rb', line 40 def thirty_day_totals( = {}) client.temporal_totals('30DayTotals',self.user_id, ) end |