Class: Wes::Data::API::Model::Video

Inherits:
Base
  • Object
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

Constructor Details

This class inherits a constructor from Wes::Data::API::Model::Base

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_userObject



10
11
12
13
14
15
# File 'lib/wes/data/api/model/video.rb', line 10

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

#set_caption(edit) ⇒ Object



17
18
19
# File 'lib/wes/data/api/model/video.rb', line 17

def set_caption(edit)
  update(:caption => edit)
end

#set_state(state) ⇒ Object



21
22
23
# File 'lib/wes/data/api/model/video.rb', line 21

def set_state(state)
  update(:state => state)
end

#transcoding_state(type) ⇒ Object



34
35
36
37
38
39
# File 'lib/wes/data/api/model/video.rb', line 34

def transcoding_state(type)
  Wes::Data::API::VideoTranscodingState.find(
    id,
    type
  )
end

#update(changes) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/wes/data/api/model/video.rb', line 25

def update(changes)
  route = [routes.video, id].join("/")
  @attributes = client.put(
    route, @attributes.to_h.merge(changes)
  ).first

  self
end