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, brief.brand_id)
end
|
#brief ⇒ Object
30
31
32
33
34
|
# File 'lib/woody/decorators/video.rb', line 30
def brief
@brief ||= Wes::Data::API::Brief.find(
:id, submission.brief_id
)
end
|
#creator ⇒ Object
36
37
38
39
40
|
# 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
42
43
44
45
46
47
48
49
|
# File 'lib/woody/decorators/video.rb', line 42
def gif
return 'https://i.imgur.com/jZCPUYx.gif' if dev?
video_transcoding_state('gif').path(
filename_hash,
nil,
processing_image
)
end
|
#processed? ⇒ Boolean
60
61
62
63
|
# File 'lib/woody/decorators/video.rb', line 60
def processed?
return true if dev?
type_processed?('gif') && type_processed?('mp4')
end
|
#thumbnail ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/woody/decorators/video.rb', line 51
def thumbnail
return 'https://i.imgur.com/jZCPUYx.gif' if dev?
video_transcoding_state('gif').path(
filename_hash,
'thumbnail',
processing_image
)
end
|
#url ⇒ Object
65
66
67
68
|
# File 'lib/woody/decorators/video.rb', line 65
def url
return dev_url if dev?
video_transcoding_state('mp4').path(filename_hash)
end
|