Class: BOTR::VideoEngagement

Inherits:
Object
  • Object
show all
Defined in:
lib/botr/videos/video_engagement.rb

Overview

The BOTR::VideoEngagement class contains calls for for displaying video engagement data.

Engagement analytics allow you to track which sections of a video are being watched by users. These analytics are useful for determining:

Drop off rates: Many users might drop off at a certain point in the video. Editing that section might increase engagement. Replay rates: Many users might replay a certain section in the video. This might be a location to target ads against.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Authentication

#signature

Methods included from API

#api_call_class, #api_format, #api_key, #api_nonce, #api_protocol, #api_secret_key, #api_server, #api_timestamp, #api_url, #api_version, #progress_url, #upload_address, #upload_key, #upload_protocol, #upload_token, #upload_url

Methods included from HTTP

#client, #delete_request, #get_request, #post_request, #put_request

Constructor Details

#initialize(params = {}) ⇒ VideoEngagement

Returns a new instance of VideoEngagement.


58
59
60
61
62
63
64
# File 'lib/botr/videos/video_engagement.rb', line 58

def initialize(params = {})
	params.each do |key, val|
		param = "@#{key.to_s}"
		next unless methods.include? key.to_sym
		instance_variable_set(param, val)
	end		
end

Class Attribute Details

.last_statusObject (readonly)

Returns the value of attribute last_status


17
18
19
# File 'lib/botr/videos/video_engagement.rb', line 17

def last_status
  @last_status
end

Instance Attribute Details

#engagementsObject (readonly)

Returns the value of attribute engagements


56
57
58
# File 'lib/botr/videos/video_engagement.rb', line 56

def engagements
  @engagements
end

#keyObject (readonly)

Returns the value of attribute key


56
57
58
# File 'lib/botr/videos/video_engagement.rb', line 56

def key
  @key
end

#last_statusObject (readonly)

Returns the value of attribute last_status


56
57
58
# File 'lib/botr/videos/video_engagement.rb', line 56

def last_status
  @last_status
end

Class Method Details

.call_classObject


19
20
21
# File 'lib/botr/videos/video_engagement.rb', line 19

def call_class
	"videos/engagement"
end

.show(video_key) ⇒ BOTR::VideoEngagement Also known as: find

engagement analytics for

Parameters:

  • video_key (String)

    the key of the video to display

Returns:

  • (BOTR::VideoEngagement)

    a new object with the engagement analytics of the video referenced by the video key


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/botr/videos/video_engagement.rb', line 30

def show(video_key)
	json = get_request({:method => 'show',
					    :video_key => video_key})
	res = JSON.parse(json.body)

	if json.status == 200
		params = process_show_response(res)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return new(params)
end