Class: BOTR::VideoTag

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

Overview

The BOTR::VideoTag class contains calls for manipulating video tags.

Tags are essentially labels that can be used for the classification of videos.

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 = {}) ⇒ VideoTag

Returns a new instance of VideoTag.


63
64
65
66
67
68
69
# File 'lib/botr/videos/video_tag.rb', line 63

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


11
12
13
# File 'lib/botr/videos/video_tag.rb', line 11

def last_status
  @last_status
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


61
62
63
# File 'lib/botr/videos/video_tag.rb', line 61

def name
  @name
end

#videosObject (readonly)

Returns the value of attribute videos


61
62
63
# File 'lib/botr/videos/video_tag.rb', line 61

def videos
  @videos
end

Class Method Details

.allObject


43
44
45
# File 'lib/botr/videos/video_tag.rb', line 43

def all
	list({})
end

.list(**options) ⇒ Array

Return a list of video tags.

Parameters:

  • options (Hash)

    search parameters

Options Hash (**options):

  • search (String)

    case-insensitive search in the name tag field

  • order_by (String)

    specifies parameters by which returned result should be ordered; ":asc" and ":desc" can be appended accordingly

  • result_limit (Integer)

    specifies maximum number of tags to return; default is 50 and maximum result limit is 1000

  • result_offset (Integer)

    specifies how many tags should be skipped at the beginning of the result set; default is 0

Returns:

  • (Array)

    a list of tag objects matching the search criteria


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

def list(**options)
	json = get_request(options.merge(:method => 'list'))
	res = JSON.parse(json.body)
	
	if json.status == 200
		results = process_list_response(res)
	else
		raise "HTTP Error #{json.status}: #{json.body}"
	end

	return results
end