Class: Streamio::Video

Inherits:
Model
  • Object
show all
Defined in:
lib/streamio/video.rb

Constant Summary

Constants inherited from Model

Model::CASTED_ATTRIBUTES

Instance Attribute Summary

Attributes inherited from Model

#attributes, #errors

Instance Method Summary collapse

Methods inherited from Model

accessable_attributes, all, count, creatable_attributes, create, #created_at, destroy, #destroy, #destroyed?, find, #initialize, #persisted?, readable_attributes, #reload, resource, resource_name, #save, #tags, #updated_at

Constructor Details

This class inherits a constructor from Streamio::Model

Instance Method Details

#add_transcoding(parameters) ⇒ Boolean

Adds a transcoding to the video instance and reloads itself to reflect the changed transcodings array.

Parameters:

  • parameters (Hash)

    The parameters to pass in when creating the transcoding.

Options Hash (parameters):

  • :encoding_profile_id (String)

    Id of the Encoding Profile to be used for the transcoding.

Returns:

  • (Boolean)

    Indicating wether the transcoding was successfully created.



16
17
18
19
20
# File 'lib/streamio/video.rb', line 16

def add_transcoding(parameters)
  response = self.class.resource.post("#{id}/transcodings", parameters)
  reload
  response.code.to_i == 201
end

#delete_transcoding(transcoding_id) ⇒ Boolean

Deletes a transcoding from the video and reloads itself to reflect the changed transcodings array.

Parameters:

  • transcoding_id (String)

    The id of the transcoding to be deleted.

Returns:

  • (Boolean)

    Indicating wether the transcoding was successfully deleted.



28
29
30
31
32
# File 'lib/streamio/video.rb', line 28

def delete_transcoding(transcoding_id)
  response = self.class.resource.delete("#{id}/transcodings/#{transcoding_id}")
  reload
  response.code.to_i == 200
end