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.
14
15
16
17
18
|
# File 'lib/woody/decorators/video.rb', line 14
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
20
21
22
23
24
25
|
# File 'lib/woody/decorators/video.rb', line 20
def aspect_ratio
@aspect_ratio ||= Helper::AspectRatio.new(
@model.current_version.height,
@model.current_version.width
).class_name
end
|
#brand ⇒ Object
27
28
29
|
# File 'lib/woody/decorators/video.rb', line 27
def brand
@brand ||= Wes::Data::API::Brand.find(:id, brief.brand_id)
end
|
#brief ⇒ Object
31
32
33
34
35
36
|
# File 'lib/woody/decorators/video.rb', line 31
def brief
@brief ||= Woody::Decorators::Brief.new(
Wes::Data::API::Brief.find(:id, submission.brief_id),
@config
)
end
|
#creator ⇒ Object
38
39
40
41
42
|
# File 'lib/woody/decorators/video.rb', line 38
def creator
@creator ||= @creator_model ? @creator_model : Wes::Data::API::CreatorUser.find(
:id, submission.user_id
)
end
|
#gif ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/woody/decorators/video.rb', line 44
def gif
return 'https://i.imgur.com/jZCPUYx.gif' if dev?
return processing_image unless states?('gif')
video_transcoding_state('gif').path(
filename_hash, nil, processing_image
)
end
|
#processed? ⇒ Boolean
52
53
54
55
56
|
# File 'lib/woody/decorators/video.rb', line 52
def processed?
return true if dev?
return false unless states?('gif') && states?('mp4')
type_processed?('gif') && type_processed?('mp4')
end
|
#thumbnail ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/woody/decorators/video.rb', line 58
def thumbnail
return 'https://i.imgur.com/jZCPUYx.gif' if dev?
return processing_image unless states?('gif')
video_transcoding_state('gif').path(
filename_hash, 'thumbnail', processing_image
)
end
|
#url ⇒ Object
66
67
68
69
70
|
# File 'lib/woody/decorators/video.rb', line 66
def url
return dev_url if dev?
return '' unless states?('mp4')
video_transcoding_state('mp4').path(filename_hash)
end
|