Sha256: 6b25adb56a8a3dc1524f3db4203146fb16492e5645d2f69e6951838b7f0aeca6

Contents?: true

Size: 1.86 KB

Versions: 13

Compression:

Stored size: 1.86 KB

Contents

module Animoto
  module Resources
    class Storyboard < Animoto::Resources::Base
      
      # @private
      # @return [Hash{String=>Object}]
      # @see Animoto::Support::Support::ClassMethods#unpack_standard_envelope
      def self.unpack_metadata body = {}
        unpack_payload(body)['metadata'] || {}
      end
      
      # @return [Hash{Symbol=>Object}]
      # @see Animoto::Support::StandardEnvelope::ClassMethods#unpack_standard_envelope
      def self.unpack_standard_envelope body = {}
        metadata = unpack_metadata(body)
        super.merge({
          :duration       => metadata['duration'],
          :visuals_count  => metadata['visuals_count'],
          :preview_url    => unpack_links(body)['preview']
        })
      end
    
      # The duration (in seconds) that the video, once rendered, will be.
      # @return [Float]
      attr_reader :duration
      
      # The number of visuals (title cards, images, etc.) in this storyboard.
      # @return [Integer]
      attr_reader :visuals_count
      
      # If available, the URL to the low-resolution 'preview' video.
      # @return [String]
      attr_reader :preview_url
      
      # Sets the attributes for a new storyboard.
      #
      # @param [Hash] attributes
      # @option attributes [Integer] :duration the duration (in seconds) the rendered video will be
      # @option attributes [Integer] :visuals_count the number of visuals the rendered video will have
      # @option attributes [String] :preview_url URL to a low-resolution preview of the rendered video
      # @return [Resources::Storyboard] the storyboard
      # @see Animoto::Resources::Base#instantiate
      def instantiate attributes = {}
        @duration = attributes[:duration]
        @visuals_count = attributes[:visuals_count]
        @preview_url = attributes[:preview_url]
        super
      end
        
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
animoto-1.5.6 ./lib/animoto/resources/storyboard.rb
animoto-1.5.5 ./lib/animoto/resources/storyboard.rb
animoto-1.5.4 ./lib/animoto/resources/storyboard.rb
animoto-1.5.3 ./lib/animoto/resources/storyboard.rb
animoto-1.5.2 ./lib/animoto/resources/storyboard.rb
animoto-1.5.1 ./lib/animoto/resources/storyboard.rb
animoto-1.5.0 ./lib/animoto/resources/storyboard.rb
animoto-1.3.1 ./lib/animoto/resources/storyboard.rb
animoto-1.3.0 ./lib/animoto/resources/storyboard.rb
animoto-1.2.0 ./lib/animoto/resources/storyboard.rb
animoto-1.1.1 ./lib/animoto/resources/storyboard.rb
animoto-1.1.0 ./lib/animoto/resources/storyboard.rb
animoto-1.0.0 ./lib/animoto/resources/storyboard.rb