Class: Wes::Data::API::Model::Video
- Inherits:
-
Base
- Object
- Base
- Wes::Data::API::Model::Video
show all
- Defined in:
- lib/wes/data/api/model/video.rb
Instance Attribute Summary
Attributes inherited from Base
#attributes
Instance Method Summary
collapse
Methods inherited from Base
#exist?, #id, #initialize
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Wes::Data::API::Model::Base
Instance Method Details
#creator_user ⇒ Object
14
15
16
17
18
19
|
# File 'lib/wes/data/api/model/video.rb', line 14
def creator_user
route = [routes.video, id, routes.creator_user].join('/')
attributes = client.get(route).first
attributes.nil? ? nil
: Wes::Data::API::Model::CreatorUser.new(attributes)
end
|
#current_version(fetch: false) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/wes/data/api/model/video.rb', line 48
def current_version(fetch: false)
if fetch
fetch_current_version
else
Wes::Data::API::Model::VideoVersion.new(
@attributes.current_version.first
)
end
end
|
#set_caption(edit) ⇒ Object
21
22
23
|
# File 'lib/wes/data/api/model/video.rb', line 21
def set_caption(edit)
update(caption: edit)
end
|
#set_state(state) ⇒ Object
25
26
27
|
# File 'lib/wes/data/api/model/video.rb', line 25
def set_state(state)
update(state: state)
end
|
#submission(fetch: false) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/wes/data/api/model/video.rb', line 38
def submission(fetch: false)
if fetch
fetch_submission
else
Wes::Data::API::Model::Submission.new(
@attributes.submission.first
)
end
end
|
68
69
70
71
72
73
|
# File 'lib/wes/data/api/model/video.rb', line 68
def tags
map_objects(
fetch_tags,
Wes::Data::API::Model::TagVideoVersion
)
end
|
#transcoding_state(type, fetch = false) ⇒ Object
58
59
60
61
62
63
64
65
66
|
# File 'lib/wes/data/api/model/video.rb', line 58
def transcoding_state(type, fetch = false)
if fetch
fetch_transcoding_state(type)
else
Wes::Data::API::Model::VideoTranscodingState.new(
find_transcoding_state(type)
)
end
end
|
#update(changes) ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/wes/data/api/model/video.rb', line 29
def update(changes)
route = [routes.video, id].join('/')
@attributes = client.put(
route, @attributes.to_h.merge(changes)
).first
self
end
|