botr 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/botr/accounts/account_usage.rb +1 -0
- data/lib/botr/channels/channel.rb +75 -2
- data/lib/botr/channels/channel_thumbnail.rb +14 -2
- data/lib/botr/channels/channel_video.rb +74 -6
- data/lib/botr/channels/channel_view.rb +59 -3
- data/lib/botr/version.rb +1 -1
- data/lib/botr/videos/video.rb +64 -4
- data/lib/botr/videos/video_caption.rb +61 -4
- data/lib/botr/videos/video_conversion.rb +46 -6
- data/lib/botr/videos/video_engagement.rb +19 -2
- data/lib/botr/videos/video_tag.rb +21 -0
- data/lib/botr/videos/video_thumbnail.rb +29 -2
- data/lib/botr/videos/video_view.rb +63 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0566390f9e32ca9a61ffeefb7530242bffed7a02
|
4
|
+
data.tar.gz: 99a2af2ac184d15fd438d8aa99cc45caacdcdd3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68a8d8d211fb8403bed97cbbbffe2ec1deab740e693f7cb6d171e7bf680be909541b5b81ed9312bcdf3dfb75ee3af33eaad1f0465196a80ab0a55dcbf7b3791f
|
7
|
+
data.tar.gz: fc9e5e878caad0e0555a59fc399b831e3692a051868334914f1f2818b5b79d20e0c3e4df8fafd544c6ba2ea4539e6a6196f1a53a738be30ff7988ab89b1b1cf0
|
@@ -0,0 +1 @@
|
|
1
|
+
# call_class = "accounts/usage"
|
@@ -1,14 +1,24 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::Channel class contains calls for creating new channels, searching
|
4
|
+
# for channels, managing the channel properties (title, description etc.) and
|
5
|
+
# deleting channels.
|
3
6
|
class Channel < BOTR::Object
|
4
7
|
|
5
8
|
class << self
|
6
9
|
|
7
10
|
attr_reader :last_status
|
8
11
|
|
9
|
-
|
12
|
+
# Show all information about a channel.
|
13
|
+
#
|
14
|
+
# @param [String] channel_key key of the channel for which to show
|
15
|
+
# information
|
16
|
+
#
|
17
|
+
# @return [BOTR::Channel] a new object with the properties of the
|
18
|
+
# channel referenced by the channel key
|
19
|
+
def show(channel_key)
|
10
20
|
json = get_request({:method => 'show',
|
11
|
-
:channel_key =>
|
21
|
+
:channel_key => channel_key})
|
12
22
|
res = JSON.parse(json.body)
|
13
23
|
|
14
24
|
if json.status == 200
|
@@ -22,6 +32,27 @@ module BOTR
|
|
22
32
|
|
23
33
|
alias :find :show
|
24
34
|
|
35
|
+
# Return a list of channels, including their most interesting
|
36
|
+
# properties.
|
37
|
+
#
|
38
|
+
# @param [Hash] options search parameters
|
39
|
+
#
|
40
|
+
# @option options [String] types_filter specifies channel type by
|
41
|
+
# which returned result should be filtered: "manual" or "dynamic"
|
42
|
+
# @option options [String] search case-insensitive search in the
|
43
|
+
# author, channel_key, description, link, title fields and custom
|
44
|
+
# fields
|
45
|
+
# @option options [String] order_by specifies parameters by which
|
46
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
47
|
+
# appended accordingly
|
48
|
+
# @option options [Integer] result_limit specifies maximum number of
|
49
|
+
# channels to return; default is 50 and maximum result limit is 1000
|
50
|
+
# @option options [Integer] result_offset specifies how many channels
|
51
|
+
# should be skipped at the beginning of the result set; default is
|
52
|
+
# 0
|
53
|
+
#
|
54
|
+
# @return [BOTR::Channel] a new object with the properties of the
|
55
|
+
# channel referenced by the channel key
|
25
56
|
def list(**options)
|
26
57
|
json = get_request(options.merge(:method => 'list'))
|
27
58
|
res = JSON.parse(json.body)
|
@@ -69,6 +100,19 @@ module BOTR
|
|
69
100
|
end
|
70
101
|
end
|
71
102
|
|
103
|
+
# Create a new (dynamic or manual) channel.
|
104
|
+
#
|
105
|
+
# @param [String] type type of the channel: "dynamic" or "manual"
|
106
|
+
# information
|
107
|
+
# @param [Hash] options channel parameters
|
108
|
+
#
|
109
|
+
# @option options [String] title title of the channel
|
110
|
+
# @option options [String] description description of the channel
|
111
|
+
# @option options [String] link user defined URL
|
112
|
+
# @option options [String] author author of the channel
|
113
|
+
#
|
114
|
+
# @return [BOTR::Channel] this object with the properties specified in
|
115
|
+
# the options hash
|
72
116
|
def create(type, **options)
|
73
117
|
json = get_request(options.merge(:method => 'create',
|
74
118
|
:type => type))
|
@@ -83,6 +127,32 @@ module BOTR
|
|
83
127
|
return self
|
84
128
|
end
|
85
129
|
|
130
|
+
# Configure or update the properties of a channel.
|
131
|
+
#
|
132
|
+
# @param [Hash] options channel parameters
|
133
|
+
#
|
134
|
+
# @option options [String] channel_key key of the channel which should
|
135
|
+
# be configured or updated
|
136
|
+
# @option options [String] title title of the channel
|
137
|
+
# @option options [String] description description of the channel
|
138
|
+
# @option options [String] link user defined URL
|
139
|
+
# @option options [String] author author of the channel
|
140
|
+
# @option options [String] tags tags of the channel; restricts the
|
141
|
+
# inclusion of videos to the channel to the videos tagged with the
|
142
|
+
# specified tags
|
143
|
+
# @option options [String] tags_mode tags search mode for the dynamic
|
144
|
+
# channel: "all" -- a video will only be added if it has all tags
|
145
|
+
# specified in the tags parameter or "any" -- a video will be added if
|
146
|
+
# it has at least one tag specified in the tags parameter
|
147
|
+
# @option options [String] sort_order specifies sorting order of the
|
148
|
+
# videos in a dynamic channel: "date-asc", "date-desc", "title-asc",
|
149
|
+
# "title-desc", "duration-asc", "duration-desc", "views-asc" or
|
150
|
+
# "views-desc"
|
151
|
+
# @option options [Integer] videos_max maximum number of videos to
|
152
|
+
# allow in a dynamic channel; default is 10
|
153
|
+
#
|
154
|
+
# @return [BOTR::Channel] this object with the properties specified in
|
155
|
+
# the options hash
|
86
156
|
def update(**options)
|
87
157
|
json = put_request(options.merge(:channel_key => @key))
|
88
158
|
res = JSON.parse(json.body)
|
@@ -96,6 +166,9 @@ module BOTR
|
|
96
166
|
return self
|
97
167
|
end
|
98
168
|
|
169
|
+
# Delete a channel.
|
170
|
+
#
|
171
|
+
# @return [BOTR::Channel] this object with null properties
|
99
172
|
def delete
|
100
173
|
json = delete_request({:channel_key => @key})
|
101
174
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,23 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::ChannelThumbnail class contains calls that can be used to upload
|
4
|
+
# a preview image for a channel. Channels don’t have a thumb by default.
|
3
5
|
class ChannelThumbnail < BOTR::Object
|
4
6
|
|
5
7
|
class << self
|
6
8
|
|
7
9
|
attr_reader :last_status
|
8
10
|
|
9
|
-
|
11
|
+
# Show channel thumbnails creation status.
|
12
|
+
#
|
13
|
+
# @param [String] channel_key key of the channel for which to show
|
14
|
+
# thumbnails creation status
|
15
|
+
#
|
16
|
+
# @return [BOTR::ChannelThumbnail] a new object with the thumbnail
|
17
|
+
# properties of the channel referenced by the channel key
|
18
|
+
def show(channel_key)
|
10
19
|
json = get_request({:method => 'show',
|
11
|
-
:channel_key =>
|
20
|
+
:channel_key => channel_key})
|
12
21
|
res = JSON.parse(json.body)
|
13
22
|
|
14
23
|
if json.status == 200
|
@@ -44,6 +53,9 @@ module BOTR
|
|
44
53
|
raise ArgumentError, "You must specify a channel key." if @key.nil?
|
45
54
|
end
|
46
55
|
|
56
|
+
# Update a channel thumbnail by uploading an image.
|
57
|
+
#
|
58
|
+
# @return [BOTR::ChannelThumbnail] this object with an upload URL
|
47
59
|
def update
|
48
60
|
json = put_request({:channel_key => @key})
|
49
61
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,30 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::ChannelVideo class contains calls for requesting channel videos
|
4
|
+
# in the dynamic playlist. For manual channels, these calls can also be used
|
5
|
+
# to add, change video position or remove video from the playlist.
|
3
6
|
class ChannelVideo < BOTR::Object
|
4
7
|
|
5
8
|
class << self
|
6
9
|
|
7
10
|
attr_reader :last_status
|
8
11
|
|
9
|
-
|
12
|
+
# Show information for a video from the channel.
|
13
|
+
#
|
14
|
+
# @param [String] channel_key key of the channel to which the video
|
15
|
+
# belongs
|
16
|
+
# @params [Hash] options channel video parameters
|
17
|
+
#
|
18
|
+
# @option options [String] video_key key of the video which
|
19
|
+
# information to show
|
20
|
+
# @option options [Integer] position position of the video in the
|
21
|
+
# channel for which to show information
|
22
|
+
#
|
23
|
+
# @return [BOTR::ChannelVideo] a new object with the properties of
|
24
|
+
# the video referenced by the video key or the position
|
25
|
+
def show(channel_key, **options)
|
10
26
|
json = get_request(options.merge(:method => 'show',
|
11
|
-
:channel_key =>
|
27
|
+
:channel_key => channel_key))
|
12
28
|
res = JSON.parse(json.body)
|
13
29
|
|
14
30
|
if json.status == 200
|
@@ -22,9 +38,22 @@ module BOTR
|
|
22
38
|
|
23
39
|
alias :find :show
|
24
40
|
|
25
|
-
|
41
|
+
# Return list of videos in the channel.
|
42
|
+
#
|
43
|
+
# @param [String] channel_key key of the channel for which videos
|
44
|
+
# should be listed
|
45
|
+
# @params [Hash] options channel video parameters
|
46
|
+
#
|
47
|
+
# @option options [Integer] result_limit specifies maximum number of
|
48
|
+
# videos to return; default is 50 and maximum result limit is 1000.
|
49
|
+
# @option options [Integer] result_offset specifies how many videos
|
50
|
+
# should be skipped at the beginning of the result set
|
51
|
+
#
|
52
|
+
# @return [Array] a list of video objects in the channel specified
|
53
|
+
# by the channel key
|
54
|
+
def list(channel_key, **options)
|
26
55
|
json = get_request(options.merge(:method => 'list',
|
27
|
-
:channel_key =>
|
56
|
+
:channel_key => channel_key))
|
28
57
|
res = JSON.parse(json.body)
|
29
58
|
|
30
59
|
if json.status == 200
|
@@ -36,6 +65,19 @@ module BOTR
|
|
36
65
|
return results
|
37
66
|
end
|
38
67
|
|
68
|
+
# Move a video to a different position in a manual channel.
|
69
|
+
#
|
70
|
+
# @param [String] channel_key key of the channel which should be
|
71
|
+
# updated
|
72
|
+
# @params [Hash] options channel video parameters
|
73
|
+
#
|
74
|
+
# @option options [String] position_from position in the channel
|
75
|
+
# of the video which should be moved
|
76
|
+
# @option options [Integer] position_to position in the channel
|
77
|
+
# of where the video which should be moved
|
78
|
+
#
|
79
|
+
# @return [BOTR::ChannelVideo] this object with the status of the
|
80
|
+
# move operation
|
39
81
|
def update(channel_key, **options)
|
40
82
|
json = put_request(options.merge(:channel_key => channel_key))
|
41
83
|
res = JSON.parse(json.body)
|
@@ -84,6 +126,19 @@ module BOTR
|
|
84
126
|
raise ArgumentError, "You must specify a video key." if @key.nil?
|
85
127
|
end
|
86
128
|
|
129
|
+
# Add a video to the playlist of a manual channel.
|
130
|
+
#
|
131
|
+
# @param [String] channel_key key of the channel to which the video
|
132
|
+
# belongs
|
133
|
+
# @params [Hash] options channel video parameters
|
134
|
+
#
|
135
|
+
# @option options [String] video_key key of the video that should be
|
136
|
+
# added to the channel
|
137
|
+
# @option options [Integer] position indicates where to insert the new
|
138
|
+
# video; defaults to insertion at the end
|
139
|
+
#
|
140
|
+
# @return [BOTR::ChannelVideo] this object with the status of the add
|
141
|
+
# operation
|
87
142
|
def create(channel_key, **options)
|
88
143
|
json = get_request(options.merge(:method => 'create',
|
89
144
|
:channel_key => channel_key,
|
@@ -99,8 +154,21 @@ module BOTR
|
|
99
154
|
return self
|
100
155
|
end
|
101
156
|
|
102
|
-
|
103
|
-
|
157
|
+
# Delete a video from the playlist of a manual channel.
|
158
|
+
#
|
159
|
+
# @param [String] channel_key key of the channel from which video should
|
160
|
+
# be deleted
|
161
|
+
# @params [Hash] options channel video parameters
|
162
|
+
#
|
163
|
+
# @option options [String] video_key key of the video; all videos with
|
164
|
+
# this key will be deleted from the channel
|
165
|
+
# @option options [Integer] position_to video position in the channel;
|
166
|
+
# only video at this position will be deleted from the channel
|
167
|
+
#
|
168
|
+
# @return [BOTR::ChannelVideo] this object with the status of the delete
|
169
|
+
# operation and all other parameters nulled
|
170
|
+
def delete(channel_key, **options)
|
171
|
+
json = delete_request(options.merge(:channel_key => channel_key))
|
104
172
|
res = JSON.parse(json.body)
|
105
173
|
|
106
174
|
if json.status == 200
|
@@ -1,14 +1,42 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::ChannelView class contains calls for requesting channel views
|
4
|
+
# statistics.
|
5
|
+
#
|
6
|
+
# A channel view is counted every time:
|
7
|
+
#
|
8
|
+
# The RSS feed of that channel is requested from the content server.
|
9
|
+
# A player from our content server containing a channel is embedded in a
|
10
|
+
# webpage.
|
3
11
|
class ChannelView < BOTR::Object
|
4
12
|
|
5
13
|
class << self
|
6
14
|
|
7
15
|
attr_reader :last_status
|
8
|
-
|
9
|
-
|
16
|
+
|
17
|
+
# Shows views statistics for a channel.
|
18
|
+
#
|
19
|
+
# @param [String] channel_key key of the channel for which to show
|
20
|
+
# information
|
21
|
+
# @param [Hash] options channel views parameters
|
22
|
+
#
|
23
|
+
# @option options [Integer] start_date Unix timestamp of date
|
24
|
+
# from which channel views statistics should be start
|
25
|
+
# @option options [Integer] end_date Unix timestamp of date
|
26
|
+
# on which channel views statistics should be end
|
27
|
+
# @option options [String] aggregate specifies if returned channel
|
28
|
+
# views statistics should be aggregate: true or false
|
29
|
+
# @option options [String] group_days specifies if returned channel
|
30
|
+
# views statistics should be grouped by year and month
|
31
|
+
# @option options [String] include_empty_days specifies if channel
|
32
|
+
# views statistics should include days for which there is no
|
33
|
+
# statistics available: true or false
|
34
|
+
#
|
35
|
+
# @return [BOTR::ChannelView] a new object with the view statistics
|
36
|
+
# of the channel referenced by the channel key
|
37
|
+
def show(channel_key, **options)
|
10
38
|
json = get_request(options.merge(:method => 'show',
|
11
|
-
:channel_key =>
|
39
|
+
:channel_key => channel_key))
|
12
40
|
res = JSON.parse(json.body)
|
13
41
|
|
14
42
|
if json.status == 200
|
@@ -22,6 +50,34 @@ module BOTR
|
|
22
50
|
|
23
51
|
alias :find :show
|
24
52
|
|
53
|
+
# List channel views statistics per channel or per day.
|
54
|
+
#
|
55
|
+
# @params [Hash] options stats parameters
|
56
|
+
#
|
57
|
+
# @option options [Integer] start_date Unix timestamp of date
|
58
|
+
# from which channel views statistics should be start
|
59
|
+
# @option options [Integer] end_date Unix timestamp of date
|
60
|
+
# on which channel views statistics should be end
|
61
|
+
# @option options [String] list_by specifies channel views statistics
|
62
|
+
# listing type: "channel" or "day"
|
63
|
+
# @option options [String] order_by specifies parameters by which
|
64
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
65
|
+
# appended accordingly
|
66
|
+
# @option options [Integer] result_limit specifies maximum number
|
67
|
+
# of channels to return: default is 50 and maximum result limit is
|
68
|
+
# 1000
|
69
|
+
# @option options [Integer] result_offset specifies how many channels
|
70
|
+
# should be skipped at the beginning of the result set
|
71
|
+
# @option options [String] aggregate specifies if returned channel
|
72
|
+
# views statistics should be aggregate: true or false
|
73
|
+
# @option options [String] group_days specifies if returned channel
|
74
|
+
# views statistics should be grouped by year and month
|
75
|
+
# @option options [String] include_empty_days specifies if channel
|
76
|
+
# views statistics should include days for which there is no
|
77
|
+
# statistics available: true or false
|
78
|
+
#
|
79
|
+
# @return [Array] a list of objects with the statistics of the
|
80
|
+
# all channels matching the given criteria
|
25
81
|
def list(**options)
|
26
82
|
json = get_request(options.merge(:method => 'list'))
|
27
83
|
res = JSON.parse(json.body)
|
data/lib/botr/version.rb
CHANGED
data/lib/botr/videos/video.rb
CHANGED
@@ -7,7 +7,6 @@ module BOTR
|
|
7
7
|
# A video object is a metadata container that actually contains multiple
|
8
8
|
# video files (conversions). It does _not_ reference the actual video file
|
9
9
|
# located on the content server.
|
10
|
-
#
|
11
10
|
class Video < BOTR::Object
|
12
11
|
|
13
12
|
class << self
|
@@ -44,10 +43,30 @@ module BOTR
|
|
44
43
|
# with these tags (multiple tags should be comma-separated)
|
45
44
|
# @option options [String] tags_mode tags search mode: "all" -- a
|
46
45
|
# video will only be listed if it has all tags specified in the
|
47
|
-
# tags parameter or "any" --
|
46
|
+
# tags parameter or "any" -- a video will be listed if it has at
|
48
47
|
# least one tag specified in the tags parameter
|
48
|
+
# @option options [String] search case-insensitive search in the
|
49
|
+
# author, description, link, md5, tags, title and video_key fields
|
50
|
+
# @option options [String] mediatypes_filter list only videos with
|
51
|
+
# the specified media types: "unknown", "audio", "video"
|
52
|
+
# @option options [String] statuses_filter list only videos with the
|
53
|
+
# specified statuses: "created", "processing", "ready", "updating",
|
54
|
+
# "failed"
|
55
|
+
# @option options [String] order_by specifies parameters by which
|
56
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
57
|
+
# appended accordingly
|
58
|
+
# @option options [Integer] start_date video creation date starting
|
59
|
+
# from which videos list should be returned as a UNIX timestamp
|
60
|
+
# @option options [Integer] end_date video creation date until
|
61
|
+
# (and including) which videos list should be returned as a UNIX
|
62
|
+
# timestamp
|
63
|
+
# @option options [Integer] result_limit specifies maximum number of
|
64
|
+
# videos to return; default is 50 and maximum result limit is 1000
|
65
|
+
# @option options [Integer] result_offset specifies how many videos
|
66
|
+
# should be skipped at the beginning of the result set; default is
|
67
|
+
# 0
|
49
68
|
#
|
50
|
-
# @return [Array] a list of video
|
69
|
+
# @return [Array] a list of video objects matching the search
|
51
70
|
# criteria
|
52
71
|
def list(**options)
|
53
72
|
json = get_request(options.merge(:method => 'list'))
|
@@ -64,7 +83,7 @@ module BOTR
|
|
64
83
|
|
65
84
|
# Return a list of all videos.
|
66
85
|
#
|
67
|
-
# @note Same as calling list with no arguments given.
|
86
|
+
# @note Same as calling `list` with no arguments given.
|
68
87
|
def all
|
69
88
|
list({})
|
70
89
|
end
|
@@ -101,6 +120,25 @@ module BOTR
|
|
101
120
|
end
|
102
121
|
end
|
103
122
|
|
123
|
+
# Create a new video by sending metadata and requesting an upload URL.
|
124
|
+
#
|
125
|
+
# @param [Hash] options video parameters
|
126
|
+
#
|
127
|
+
# @option options [String] title title of the video
|
128
|
+
# @option options [String] tags tags for the video; multiple tags should
|
129
|
+
# be comma-separated
|
130
|
+
# @option options [String] description description of the video
|
131
|
+
# @option options [String] author author of the video
|
132
|
+
# @option options [Integer] date video creation date as UNIX timestamp
|
133
|
+
# @option options [String] link the URL of the web page where this video
|
134
|
+
# is published
|
135
|
+
# @option options [String] download_url URL from where to fetch a video
|
136
|
+
# file; only URLs with the http protocol are supported
|
137
|
+
# @option options [String] md5 video file MD5 message digest
|
138
|
+
# @option options [Integer] size video file size
|
139
|
+
#
|
140
|
+
# @return [BOTR::Video] this video object with the parameters specified in
|
141
|
+
# the options hash and an upload link
|
104
142
|
def create(**options)
|
105
143
|
json = get_request(options.merge(:method => 'create'))
|
106
144
|
res = JSON.parse(json.body)
|
@@ -127,6 +165,25 @@ module BOTR
|
|
127
165
|
return self
|
128
166
|
end
|
129
167
|
|
168
|
+
# Update the properties of a video.
|
169
|
+
#
|
170
|
+
# @param [Hash] options video parameters
|
171
|
+
#
|
172
|
+
# @option options [String] title title of the video
|
173
|
+
# @option options [String] tags tags for the video; multiple tags should
|
174
|
+
# be comma-separated
|
175
|
+
# @option options [String] description description of the video
|
176
|
+
# @option options [String] author author of the video
|
177
|
+
# @option options [Integer] date video creation date as UNIX timestamp
|
178
|
+
# @option options [String] link the URL of the web page where this video
|
179
|
+
# is published
|
180
|
+
# @option options [String] download_url URL from where to fetch a video
|
181
|
+
# file; only URLs with the http protocol are supported
|
182
|
+
# @option options [String] md5 video file MD5 message digest
|
183
|
+
# @option options [Integer] size video file size
|
184
|
+
#
|
185
|
+
# @return [BOTR::Video] this object with the properties of the
|
186
|
+
# video referenced by the options hash
|
130
187
|
def update(**options)
|
131
188
|
json = put_request(options.merge(:video_key => @key))
|
132
189
|
res = JSON.parse(json.body)
|
@@ -140,6 +197,9 @@ module BOTR
|
|
140
197
|
return self
|
141
198
|
end
|
142
199
|
|
200
|
+
# Remove a video and all of its conversions from the server.
|
201
|
+
#
|
202
|
+
# @return [BOTR::Video] this object with null properties
|
143
203
|
def delete
|
144
204
|
json = delete_request({:video_key => @key})
|
145
205
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,22 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoCaption class contains calls for manipulating videos captions.
|
3
4
|
class VideoCaption < BOTR::Object
|
4
5
|
|
5
6
|
class << self
|
6
7
|
|
7
8
|
attr_reader :last_status
|
8
9
|
|
9
|
-
|
10
|
+
# Show video caption information.
|
11
|
+
#
|
12
|
+
# @param [String] caption_key key of the caption which information
|
13
|
+
# to show
|
14
|
+
#
|
15
|
+
# @return [BOTR::VideoCaption] a new object with the properties of the
|
16
|
+
# caption referenced by the caption_key
|
17
|
+
def show(video_key)
|
10
18
|
json = get_request({:method => 'show',
|
11
|
-
:caption_key =>
|
19
|
+
:caption_key => video_key})
|
12
20
|
res = JSON.parse(json.body)
|
13
21
|
|
14
22
|
if json.status == 200
|
@@ -22,9 +30,31 @@ module BOTR
|
|
22
30
|
|
23
31
|
alias :find :show
|
24
32
|
|
25
|
-
|
33
|
+
# Return a list of videos captions.
|
34
|
+
#
|
35
|
+
# @param [Hash] options search parameters
|
36
|
+
#
|
37
|
+
# @option options [String] video_key key of the video which captions
|
38
|
+
# to list
|
39
|
+
# @option options [String] search case-insensitive search in the
|
40
|
+
# caption key and label fields
|
41
|
+
# @option options [String] statuses_filter list only captions with
|
42
|
+
# the specified statuses: "processing", "ready", "updating",
|
43
|
+
# "failed", "deleted"
|
44
|
+
# @option options [String] order_by specifies parameters by which
|
45
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
46
|
+
# appended accordingly
|
47
|
+
# @option options [Integer] result_limit specifies maximum number of
|
48
|
+
# captions to return; default is 50 and maximum result limit is 1000
|
49
|
+
# @option options [Integer] result_offset specifies how many captions
|
50
|
+
# should be skipped at the beginning of the result set; default is
|
51
|
+
# 0
|
52
|
+
#
|
53
|
+
# @return [Array] a list of video caption objects matching the search
|
54
|
+
# criteria
|
55
|
+
def list(video_key, **options)
|
26
56
|
json = get_request(options.merge(:method => 'list',
|
27
|
-
:video_key =>
|
57
|
+
:video_key => video_key))
|
28
58
|
res = JSON.parse(json.body)
|
29
59
|
|
30
60
|
if json.status == 200
|
@@ -67,6 +97,20 @@ module BOTR
|
|
67
97
|
end
|
68
98
|
end
|
69
99
|
|
100
|
+
# Create a new video caption.
|
101
|
+
#
|
102
|
+
# @param [String] video_key key of the video for which caption should be
|
103
|
+
# created
|
104
|
+
# @param [Hash] options caption parameters
|
105
|
+
#
|
106
|
+
# @option options [String] label caption label
|
107
|
+
# @option options [Integer] position indicates where to insert the new
|
108
|
+
# caption; default is to insert at the end of the list
|
109
|
+
# @option options [String] md5 caption file MD5 message digest
|
110
|
+
# @option options [Integer] size caption file size
|
111
|
+
#
|
112
|
+
# @return [BOTR::VideoCaption] this video caption object with the
|
113
|
+
# parameters specified in the options hash and an upload link
|
70
114
|
def create(video_key, **options)
|
71
115
|
json = get_request(options.merge(:method => 'create',
|
72
116
|
:video_key => video_key))
|
@@ -94,6 +138,16 @@ module BOTR
|
|
94
138
|
return self
|
95
139
|
end
|
96
140
|
|
141
|
+
# Update video caption.
|
142
|
+
#
|
143
|
+
# @param [Hash] options caption parameters
|
144
|
+
#
|
145
|
+
# @option options [String] label caption label
|
146
|
+
# @option options [Integer] position indicates where to insert the new
|
147
|
+
# caption; default is to insert at the end of the list
|
148
|
+
#
|
149
|
+
# @return [BOTR::VideoCaption] this video caption object with the
|
150
|
+
# parameters specified in the options hash and an optional upload link
|
97
151
|
def update(**options)
|
98
152
|
json = put_request(options.merge(:caption_key => @key))
|
99
153
|
res = JSON.parse(json.body)
|
@@ -107,6 +161,9 @@ module BOTR
|
|
107
161
|
return self
|
108
162
|
end
|
109
163
|
|
164
|
+
# Delete a video caption.
|
165
|
+
#
|
166
|
+
# @return [BOTR::VideoCaption] this object with null properties
|
110
167
|
def delete
|
111
168
|
json = delete_request({:caption_key => @key})
|
112
169
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,27 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoConversion class calls are used to create, search for and
|
4
|
+
# delete individual video files (conversions) inside a video object.
|
5
|
+
#
|
6
|
+
# A conversion is always created by applying a transcoding template to a
|
7
|
+
# video. A template contains information for the dimensions, bitrate and
|
8
|
+
# watermark of the resulting conversion.
|
3
9
|
class VideoConversion < BOTR::Object
|
4
10
|
|
5
11
|
class << self
|
6
12
|
|
7
13
|
attr_reader :last_status
|
8
14
|
|
9
|
-
|
15
|
+
# Show video conversion information.
|
16
|
+
#
|
17
|
+
# @param [String] conversion_key key of the conversion for which to
|
18
|
+
# show information
|
19
|
+
#
|
20
|
+
# @return [BOTR::VideoConversion] a new object with the properties
|
21
|
+
# of the conversion referenced by the conversion_key
|
22
|
+
def show(conversion_key)
|
10
23
|
json = get_request({:method => 'show',
|
11
|
-
:conversion_key =>
|
24
|
+
:conversion_key => conversion_key})
|
12
25
|
res = JSON.parse(json.body)
|
13
26
|
|
14
27
|
if json.status == 200
|
@@ -22,9 +35,24 @@ module BOTR
|
|
22
35
|
|
23
36
|
alias :find :show
|
24
37
|
|
25
|
-
|
26
|
-
|
27
|
-
|
38
|
+
# List conversions for a given video.
|
39
|
+
#
|
40
|
+
# @param [String] video_key key of the video for which to list
|
41
|
+
# conversions
|
42
|
+
# @param [Hash] options result parameters
|
43
|
+
#
|
44
|
+
# @option options [Integer] result_limit specifies maximum number of
|
45
|
+
# video conversions to return; default is 50 and maximum result
|
46
|
+
# limit is 1000
|
47
|
+
# @option options [Integer] result_offset specifies how many video
|
48
|
+
# conversions should be skipped at the beginning of the result set;
|
49
|
+
# default is 0
|
50
|
+
#
|
51
|
+
# @return [Array] a list of video conversion objects for the given
|
52
|
+
# video key
|
53
|
+
def list(key, **options)
|
54
|
+
json = get_request(options.merge(:method => 'list',
|
55
|
+
:video_key => key))
|
28
56
|
res = JSON.parse(json.body)
|
29
57
|
|
30
58
|
if json.status == 200
|
@@ -64,9 +92,18 @@ module BOTR
|
|
64
92
|
param = "@#{key.to_s}"
|
65
93
|
next unless methods.include? key.to_sym
|
66
94
|
instance_variable_set(param, val)
|
67
|
-
end
|
95
|
+
end
|
68
96
|
end
|
69
97
|
|
98
|
+
# Create a new conversion of a video.
|
99
|
+
#
|
100
|
+
# @param [String] video_key key of the video for which conversion should
|
101
|
+
# be created
|
102
|
+
# @param [String] template_key key of the conversion template that
|
103
|
+
# should be used for this conversion.
|
104
|
+
#
|
105
|
+
# @return [BOTR::VideoConversion] this object with the properties
|
106
|
+
# of the conversion referenced by the template_key
|
70
107
|
def create(video_key, template_key)
|
71
108
|
json = get_request({:method => 'create',
|
72
109
|
:video_key => video_key,
|
@@ -82,6 +119,9 @@ module BOTR
|
|
82
119
|
return self
|
83
120
|
end
|
84
121
|
|
122
|
+
# Delete a video conversion from the CDN.
|
123
|
+
#
|
124
|
+
# @return [BOTR::VideoConversion] this object with null properties
|
85
125
|
def delete
|
86
126
|
json = delete_request({:conversion_key => @key})
|
87
127
|
res = JSON.parse(json.body)
|
@@ -1,5 +1,15 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoEngagement class contains calls for for displaying video
|
4
|
+
# engagement data.
|
5
|
+
#
|
6
|
+
# Engagement analytics allow you to track which sections of a video are
|
7
|
+
# being watched by users. These analytics are useful for determining:
|
8
|
+
#
|
9
|
+
# Drop off rates: Many users might drop off at a certain point in the video.
|
10
|
+
# Editing that section might increase engagement.
|
11
|
+
# Replay rates: Many users might replay a certain section in the video.
|
12
|
+
# This might be a location to target ads against.
|
3
13
|
class VideoEngagement < BOTR::Object
|
4
14
|
|
5
15
|
class << self
|
@@ -10,9 +20,16 @@ module BOTR
|
|
10
20
|
"videos/engagement"
|
11
21
|
end
|
12
22
|
|
13
|
-
|
23
|
+
# Displays engagement analytics for a single video.
|
24
|
+
#
|
25
|
+
# @param [String] video_key the key of the video to display
|
26
|
+
# engagement analytics for
|
27
|
+
#
|
28
|
+
# @return [BOTR::VideoEngagement] a new object with the engagement
|
29
|
+
# analytics of the video referenced by the video key
|
30
|
+
def show(video_key)
|
14
31
|
json = get_request({:method => 'show',
|
15
|
-
:video_key =>
|
32
|
+
:video_key => video_key})
|
16
33
|
res = JSON.parse(json.body)
|
17
34
|
|
18
35
|
if json.status == 200
|
@@ -1,11 +1,32 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoTag class contains calls for manipulating video tags.
|
4
|
+
#
|
5
|
+
# Tags are essentially labels that can be used for the classification of
|
6
|
+
# videos.
|
3
7
|
class VideoTag < BOTR::Object
|
4
8
|
|
5
9
|
class << self
|
6
10
|
|
7
11
|
attr_reader :last_status
|
8
12
|
|
13
|
+
# Return a list of video tags.
|
14
|
+
#
|
15
|
+
# @param [Hash] options search parameters
|
16
|
+
#
|
17
|
+
# @option options [String] search case-insensitive search in the
|
18
|
+
# name tag field
|
19
|
+
# @option options [String] order_by specifies parameters by which
|
20
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
21
|
+
# appended accordingly
|
22
|
+
# @option options [Integer] result_limit specifies maximum number of
|
23
|
+
# tags to return; default is 50 and maximum result limit is 1000
|
24
|
+
# @option options [Integer] result_offset specifies how many tags
|
25
|
+
# should be skipped at the beginning of the result set; default is
|
26
|
+
# 0
|
27
|
+
#
|
28
|
+
# @return [Array] a list of tag objects matching the search
|
29
|
+
# criteria
|
9
30
|
def list(**options)
|
10
31
|
json = get_request(options.merge(:method => 'list'))
|
11
32
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,23 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoThumbnail class contains calls for managing the preview
|
4
|
+
# image of a video.
|
3
5
|
class VideoThumbnail < BOTR::Object
|
4
6
|
|
5
7
|
class << self
|
6
8
|
|
7
9
|
attr_reader :last_status
|
8
10
|
|
9
|
-
|
11
|
+
# Show video thumbnails creation status.
|
12
|
+
#
|
13
|
+
# @param [String] video_key key of the video for which to show
|
14
|
+
# thumbnails creation status
|
15
|
+
#
|
16
|
+
# @return [BOTR::VideoThumbnail] a new object with the thumbnail status of
|
17
|
+
# the video referenced by the video key
|
18
|
+
def show(video_key)
|
10
19
|
json = get_request({:method => 'show',
|
11
|
-
:video_key =>
|
20
|
+
:video_key => video_key})
|
12
21
|
res = JSON.parse(json.body)
|
13
22
|
|
14
23
|
if json.status == 200
|
@@ -43,6 +52,24 @@ module BOTR
|
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
55
|
+
# Update a video’s thumbnail by either setting a frame from the video or
|
56
|
+
# uploading an image.
|
57
|
+
#
|
58
|
+
# @param [Hash] options video parameters
|
59
|
+
#
|
60
|
+
# @option options [Float] position video frame position in seconds from
|
61
|
+
# which thumbnail should be generated; seconds can be given as a whole
|
62
|
+
# number (e.g: 7) or with the fractions (e.g.: 7.42)
|
63
|
+
# @option options [String] tags tags for the video; multiple tags should
|
64
|
+
# be comma-separated
|
65
|
+
# @option options [Integer] thumbnail_index index of the image in the
|
66
|
+
# thumbnail strip to use as a video thumbnail; thumbnail index starts
|
67
|
+
# from 1
|
68
|
+
# @option options [String] md5 thumbnail file MD5 message digest
|
69
|
+
# @option options [Integer] size thumbnail file size
|
70
|
+
#
|
71
|
+
# @return [BOTR::VideoThumbnail] this video thumbnail object with an
|
72
|
+
# optional upload link
|
46
73
|
def update(**options)
|
47
74
|
json = put_request(options.merge(:video_key => @key))
|
48
75
|
res = JSON.parse(json.body)
|
@@ -1,14 +1,43 @@
|
|
1
1
|
module BOTR
|
2
2
|
|
3
|
+
# The BOTR::VideoView class contains calls for requesting video views
|
4
|
+
# statistics.
|
5
|
+
#
|
6
|
+
# A video view is counted every time:
|
7
|
+
#
|
8
|
+
# The video starts playing in one of your players.
|
9
|
+
# The video starts downloading from our content server.
|
10
|
+
# When a user scrubs through the video in a player or restarts the video, no
|
11
|
+
# additional view is counted.
|
3
12
|
class VideoView < BOTR::Object
|
4
13
|
|
5
14
|
class << self
|
6
15
|
|
7
16
|
attr_reader :last_status
|
8
17
|
|
9
|
-
|
18
|
+
# Shows views statistics for a video.
|
19
|
+
#
|
20
|
+
# @param [String] video_key key of the video for which to show views
|
21
|
+
# statistics
|
22
|
+
# @params [Hash] options stats parameters
|
23
|
+
#
|
24
|
+
# @option options [Integer] start_date Unix timestamp of date
|
25
|
+
# from which videos views statistics should be start
|
26
|
+
# @option options [Integer] end_date Unix timestamp of date
|
27
|
+
# on which videos views statistics should be end
|
28
|
+
# @option options [String] aggregate specifies if returned video
|
29
|
+
# views statistics should be aggregate: true or false
|
30
|
+
# @option options [String] group_days specifies if returned video
|
31
|
+
# views statistics should be grouped by year and month
|
32
|
+
# @option options [String] include_empty_days specifies if video
|
33
|
+
# views statistics should include days for which there is no
|
34
|
+
# statistics available: true or false
|
35
|
+
#
|
36
|
+
# @return [BOTR::VideoView] a new object with the statistics for the
|
37
|
+
# video referenced by the video_key
|
38
|
+
def show(video_key, **options)
|
10
39
|
json = get_request(options.merge(:method => 'show',
|
11
|
-
:video_key =>
|
40
|
+
:video_key => video_key))
|
12
41
|
res = JSON.parse(json.body)
|
13
42
|
|
14
43
|
if json.status == 200
|
@@ -22,6 +51,38 @@ module BOTR
|
|
22
51
|
|
23
52
|
alias :find :show
|
24
53
|
|
54
|
+
# List views statistics for a video.
|
55
|
+
#
|
56
|
+
# @params [Hash] options stats parameters
|
57
|
+
#
|
58
|
+
# @option options [Integer] start_date Unix timestamp of date
|
59
|
+
# from which video views statistics should be start
|
60
|
+
# @option options [Integer] end_date Unix timestamp of date
|
61
|
+
# on which video views statistics should be end
|
62
|
+
# @option options [String] list_by specifies video views statistics
|
63
|
+
# listing type: "video" or "day"
|
64
|
+
# @option options [String] order_by specifies parameters by which
|
65
|
+
# returned result should be ordered; ":asc" and ":desc" can be
|
66
|
+
# appended accordingly
|
67
|
+
# @option options [String] search case-insensitive search in the
|
68
|
+
# author, description, link, md5, tags, title, video_key fields and
|
69
|
+
# custom fields
|
70
|
+
# @option options [Integer] result_limit specifies maximum number
|
71
|
+
# of videos to return: default is 50 and maximum result limit is 1000
|
72
|
+
# @option options [Integer] result_offset specifies how many videos
|
73
|
+
# should be skipped at the beginning of the result set
|
74
|
+
# @option options [String] aggregate specifies if returned video
|
75
|
+
# views statistics should be aggregate: true or false
|
76
|
+
# @option options [String] group_days specifies if returned video
|
77
|
+
# views statistics should be grouped by year and month
|
78
|
+
# @option options [String] include_empty_days specifies if video
|
79
|
+
# views statistics should include days for which there is no
|
80
|
+
# statistics available: true or false
|
81
|
+
# @option options [String] statuses_filter list only videos with the
|
82
|
+
# specified statuses: "active", "deleted"
|
83
|
+
#
|
84
|
+
# @return [Array] a list of objects with the statistics of the
|
85
|
+
# all videos matching the search criteria
|
25
86
|
def list(**options)
|
26
87
|
json = get_request(options.merge(:method => 'list'))
|
27
88
|
res = JSON.parse(json.body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bertrandk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- botr.watchr
|
86
86
|
- certs/cacert.pem
|
87
87
|
- lib/botr.rb
|
88
|
+
- lib/botr/accounts/account_usage.rb
|
88
89
|
- lib/botr/api/api.rb
|
89
90
|
- lib/botr/api/authentication.rb
|
90
91
|
- lib/botr/channels/channel.rb
|