Class: Animoto::Resources::Video

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/resources/video.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#errors, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

endpoint, #endpoint, #initialize, #load, load, new, original_new, register

Methods included from Support::StandardEnvelope

find_class_for, included

Constructor Details

This class inherits a constructor from Animoto::Resources::Base

Instance Attribute Details

#cover_image_urlString (readonly)

If available, the URL to the cover image file.

Returns:

  • (String)


42
43
44
# File 'lib/animoto/resources/video.rb', line 42

def cover_image_url
  @cover_image_url
end

#download_urlString (readonly)

The URL to the video file.

Returns:

  • (String)


30
31
32
# File 'lib/animoto/resources/video.rb', line 30

def download_url
  @download_url
end

#formatString (readonly)

The format of the video.

Returns:

  • (String)


50
51
52
# File 'lib/animoto/resources/video.rb', line 50

def format
  @format
end

#framerateInteger (readonly)

The framerate of the video.

Returns:

  • (Integer)


54
55
56
# File 'lib/animoto/resources/video.rb', line 54

def framerate
  @framerate
end

#resolutionString (readonly)

The resolution of the video.

Returns:

  • (String)


58
59
60
# File 'lib/animoto/resources/video.rb', line 58

def resolution
  @resolution
end

#storyboardResources::Storyboard (readonly)

The Storyboard object this video was rendered from.



38
39
40
# File 'lib/animoto/resources/video.rb', line 38

def storyboard
  @storyboard
end

#storyboard_urlString (readonly)

The URL to the storyboard resource this video was rendered from.

Returns:

  • (String)


34
35
36
# File 'lib/animoto/resources/video.rb', line 34

def storyboard_url
  @storyboard_url
end

#stream_urlString (readonly)

If available, the URL where this video can be watched via HTTP Live Streaming.

Returns:

  • (String)


46
47
48
# File 'lib/animoto/resources/video.rb', line 46

def stream_url
  @stream_url
end

Class Method Details

.unpack_rendering_parameters(body) ⇒ Hash{String=>Object}

Returns:

  • (Hash{String=>Object})

See Also:

  • Support::StandardEnvelope::ClassMethods#unpack_standard_envelope


8
9
10
# File 'lib/animoto/resources/video.rb', line 8

def self.unpack_rendering_parameters body
  (unpack_payload(body)['metadata'] || {})['rendering_parameters']
end

.unpack_standard_envelope(body) ⇒ Hash{Symbol=>Object}

Returns:

  • (Hash{Symbol=>Object})

See Also:

  • Support::StandardEnvelope::ClassMethods#unpack_standard_envelope


14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/animoto/resources/video.rb', line 14

def self.unpack_standard_envelope body
  links = unpack_links(body)
  params = unpack_rendering_parameters(body)
  super.merge({
    :download_url     => links['file'],
    :storyboard_url   => links['storyboard'],
    :cover_image_url  => links['cover_image'],
    :stream_url       => links['stream'],
    :format           => params['format'],
    :framerate        => params['framerate'],
    :resolution       => params['resolution']
  })
end

Instance Method Details

#instantiate(attributes = {}) ⇒ Resources::Video

Sets the attributes on a new video.

Parameters:

  • attributes (Hash{Symbol=>Object}) (defaults to: {})

Options Hash (attributes):

  • :download_url (String)

    the URL where this video can be downloaded

  • :storyboard_url (String)

    the URL for this video’s storyboard

  • :stream_url (String)

    the URL for this video’s HTTP Live Streaming playlist

  • :format (String)

    the format of this video

  • :framerate (Integer)

    the framerate of this video

  • :resolution (String)

    the vertical resolution of this video

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/animoto/resources/video.rb', line 71

def instantiate attributes = {}
  @download_url = attributes[:download_url]
  @storyboard_url = attributes[:storyboard_url]
  @storyboard = Animoto::Resources::Storyboard.new(:url => @storyboard_url) if @storyboard_url
  @cover_image_url = attributes[:cover_image_url]
  @stream_url = attributes[:stream_url]
  @format = attributes[:format]
  @framerate = attributes[:framerate]
  @resolution = attributes[:resolution]
  super
end