Class: Woody::Decorators::Video

Inherits:
Base
  • Object
show all
Defined in:
lib/woody/decorators/video.rb

Instance Method Summary collapse

Methods inherited from Base

#method_missing

Constructor Details

#initialize(model, config) ⇒ Video

Returns a new instance of Video.



11
12
13
14
# File 'lib/woody/decorators/video.rb', line 11

def initialize(model, config)
  @config = config
  super(model)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Woody::Decorators::Base

Instance Method Details

#aspect_ratioObject



16
17
18
# File 'lib/woody/decorators/video.rb', line 16

def aspect_ratio
  "landscape_ar16-9" # TODO
end

#brandObject



20
21
22
# File 'lib/woody/decorators/video.rb', line 20

def brand
  @brand ||= Wes::Data::API::Brand.find(:id, challenge.brand_id)
end

#challengeObject



24
25
26
27
28
# File 'lib/woody/decorators/video.rb', line 24

def challenge
  @challenge ||= Wes::Data::API::Challenge.find(
    :id, submission.challenge_id
  )
end

#gifObject



30
31
32
33
# File 'lib/woody/decorators/video.rb', line 30

def gif
  return "https://i.imgur.com/jZCPUYx.gif" if dev?
  video_transcoding_state("gif").path(filename_hash)
end

#processed?Boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'lib/woody/decorators/video.rb', line 44

def processed?
  return true if dev?
  type_processed?("gif") && type_processed?("mp4")
end

#thumbnailObject



35
36
37
38
39
40
41
42
# File 'lib/woody/decorators/video.rb', line 35

def thumbnail
  return "https://i.imgur.com/jZCPUYx.gif" if dev?
  video_transcoding_state("gif").path(
    filename_hash,
    "thumbnail",
    app_config["video_default_thumbnail"]
  )
end

#urlObject



49
50
51
52
# File 'lib/woody/decorators/video.rb', line 49

def url
  return dev_url if dev?
  video_transcoding_state("mp4").path(filename_hash)
end