Class: Woody::Decorators::Video
- Inherits:
-
Base
- Object
- Base
- Woody::Decorators::Video
show all
- Defined in:
- lib/woody/decorators/video.rb
Instance Method Summary
collapse
Methods inherited from Base
#method_missing
Constructor Details
#initialize(model, config, creator_model = nil) ⇒ Video
Returns a new instance of Video.
13
14
15
16
17
|
# File 'lib/woody/decorators/video.rb', line 13
def initialize(model, config, creator_model = nil)
@config = config
@creator_model = creator_model
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_ratio ⇒ Object
19
20
21
22
23
24
|
# File 'lib/woody/decorators/video.rb', line 19
def aspect_ratio
@aspect_ratio ||= Helper::AspectRatio.new(
@model.current_version.height,
@model.current_version.width
).class_name
end
|
#brand ⇒ Object
26
27
28
|
# File 'lib/woody/decorators/video.rb', line 26
def brand
@brand ||= Wes::Data::API::Brand.find(:id, challenge.brand_id)
end
|
#challenge ⇒ Object
30
31
32
33
34
|
# File 'lib/woody/decorators/video.rb', line 30
def challenge
@challenge ||= Wes::Data::API::Challenge.find(
:id, submission.challenge_id
)
end
|
#creator ⇒ Object
36
37
38
39
40
41
|
# File 'lib/woody/decorators/video.rb', line 36
def creator
@creator ||= @creator_model ? @creator_model : Wes::Data::API::CreatorUser.find(
:id,
submission.user_id
)
end
|
#gif ⇒ Object
43
44
45
46
|
# File 'lib/woody/decorators/video.rb', line 43
def gif
return "https://i.imgur.com/jZCPUYx.gif" if dev?
video_transcoding_state("gif").path(filename_hash)
end
|
#processed? ⇒ Boolean
57
58
59
60
|
# File 'lib/woody/decorators/video.rb', line 57
def processed?
return true if dev?
type_processed?("gif") && type_processed?("mp4")
end
|
#thumbnail ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/woody/decorators/video.rb', line 48
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
|
#url ⇒ Object
62
63
64
65
|
# File 'lib/woody/decorators/video.rb', line 62
def url
return dev_url if dev?
video_transcoding_state("mp4").path(filename_hash)
end
|