./lib/animoto/assets/image.rb in animoto-1.2.0 vs ./lib/animoto/assets/image.rb in animoto-1.3.0

- old
+ new

@@ -1,18 +1,51 @@ module Animoto module Assets class Image < Animoto::Assets::Base - include Support::Visual - include Support::Coverable - - # The EXIF rotation value for how this image should be rotated in the video. + # 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::Support::Visual#to_hash # @see Animoto::Assets::Base#to_hash def to_hash hash = super hash['rotation'] = rotation if rotation hash['spotlit'] = spotlit? unless @spotlit.nil? \ No newline at end of file