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
13
14
15
16
17
18
|
# File 'lib/wes/data/api/model/video.rb', line 13
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
47
48
49
50
51
52
53
54
55
|
# File 'lib/wes/data/api/model/video.rb', line 47
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
20
21
22
|
# File 'lib/wes/data/api/model/video.rb', line 20
def set_caption(edit)
update(caption: edit)
end
|
#set_state(state) ⇒ Object
24
25
26
|
# File 'lib/wes/data/api/model/video.rb', line 24
def set_state(state)
update(state: state)
end
|
#submission(fetch: false) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/wes/data/api/model/video.rb', line 37
def submission(fetch: false)
if fetch
fetch_submission
else
es::Data::API::Model::Submission.new(
@attributes.submission.first
)
end
end
|
#transcoding_state(type, fetch = false) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/wes/data/api/model/video.rb', line 57
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
28
29
30
31
32
33
34
35
|
# File 'lib/wes/data/api/model/video.rb', line 28
def update(changes)
route = [routes.video, id].join('/')
@attributes = client.put(
route, @attributes.to_h.merge(changes)
).first
self
end
|