Class: Animoto::Assets::Image

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/assets/image.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#source

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ Assets::Image

Creates a new Image object.

Parameters:

  • source (String)

    the source URL of this image

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

Options Hash (options):

  • :rotation (Integer)

    the number of clockwise 90-degree rotations to apply to this image

  • :spotlit (Boolean)

    whether or not to spotlight this image

  • :cover (Boolean)

    whether or not to generate the cover of this video from this image

  • :caption (String)

    the text that should be displayed with the image



44
45
46
47
48
49
50
# File 'lib/animoto/assets/image.rb', line 44

def initialize source, options = {}
  super
  @rotation = options[:rotation]
  @spotlit  = options[:spotlit]
  @cover    = options[:cover]
  @caption = options[:caption]
end

Instance Attribute Details

#captionString

Whether or not this image has a caption. If a caption is added, it will appear with the image in the video.

Returns:

  • (String)


33
34
35
# File 'lib/animoto/assets/image.rb', line 33

def caption
  @caption
end

#cover=(value) ⇒ Boolean (writeonly)

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.

Returns:

  • (Boolean)


22
23
24
# File 'lib/animoto/assets/image.rb', line 22

def cover=(value)
  @cover = value
end

#rotationInteger

The number of clockwise 90-degree rotations that should be applied to this image.

Returns:

  • (Integer)


6
7
8
# File 'lib/animoto/assets/image.rb', line 6

def rotation
  @rotation
end

#spotlit=(value) ⇒ Boolean (writeonly)

Whether or not this image is spotlit. Spotlighting a visual tells to director to add more emphasis to this visual when directing.

Returns:

  • (Boolean)


11
12
13
# File 'lib/animoto/assets/image.rb', line 11

def spotlit=(value)
  @spotlit = value
end

Instance Method Details

#cover?Boolean

Returns whether or not this footage is marked as the cover.

Returns:

  • (Boolean)


26
27
28
# File 'lib/animoto/assets/image.rb', line 26

def cover?
  @cover
end

#spotlit?Boolean

Returns whether or not this image is spotlit.

Returns:

  • (Boolean)


15
16
17
# File 'lib/animoto/assets/image.rb', line 15

def spotlit?
  @spotlit
end

#to_hashHash{String=>Object}

Returns a representation of this Image as a Hash.

Returns:

  • (Hash{String=>Object})

    this asset as a Hash

See Also:



56
57
58
59
60
61
62
63
# File 'lib/animoto/assets/image.rb', line 56

def to_hash
  hash = super
  hash['rotation'] = rotation if rotation
  hash['spotlit'] = spotlit? unless @spotlit.nil?
  hash['cover'] = cover? unless @cover.nil?
  hash['caption'] = caption unless @caption.nil?
  hash
end