Sha256: 3ba6b02d9b2a2bb574e887d04dfac0a0c086e5efc89cab27a6866faf80088d29

Contents?: true

Size: 1.96 KB

Versions: 6

Compression:

Stored size: 1.96 KB

Contents

module Animoto
  module Assets
    class Image < Animoto::Assets::Base
      # The number of clockwise 90-degree rotations that should be applied to this image.
      # @return [Integer]
      attr_accessor :rotation
      
      # Whether or not this image is spotlit. Spotlighting a visual tells to director to add
      # more emphasis to this visual when directing.
      # @return [Boolean]
      attr_writer :spotlit
      
      # Returns whether or not this image is spotlit.
      # @return [Boolean]
      def spotlit?
        @spotlit
      end
      
      # Whether or not this image is the cover of the video. If this image is the video's cover,
      # the cover image will be generated using this image.
      # @return [Boolean]
      attr_writer :cover
      
      # Returns whether or not this footage is marked as the cover.
      # @return [Boolean]
      def cover?
        @cover
      end

      # Creates a new Image object.
      #
      # @param [String] source the source URL of this image
      # @param [Hash{Symbol=>Object}] options
      # @option options [Integer] :rotation the number of clockwise 90-degree rotations to apply to this image
      # @option options [Boolean] :spotlit whether or not to spotlight this image
      # @option options [Boolean] :cover whether or not to generate the cover of this video from this image
      # @return [Assets::Image] the Image object
      def initialize source, options = {}
        super
        @rotation = options[:rotation]
        @spotlit  = options[:spotlit]
        @cover    = options[:cover]
      end
      
      # Returns a representation of this Image as a Hash.
      #
      # @return [Hash{String=>Object}] this asset as a Hash
      # @see Animoto::Assets::Base#to_hash
      def to_hash
        hash = super
        hash['rotation'] = rotation if rotation
        hash['spotlit'] = spotlit? unless @spotlit.nil?
        hash['cover'] = cover? unless @cover.nil?
        hash
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
animoto-1.5.3 ./lib/animoto/assets/image.rb
animoto-1.5.2 ./lib/animoto/assets/image.rb
animoto-1.5.1 ./lib/animoto/assets/image.rb
animoto-1.5.0 ./lib/animoto/assets/image.rb
animoto-1.3.1 ./lib/animoto/assets/image.rb
animoto-1.3.0 ./lib/animoto/assets/image.rb