Class: Applicants::VideoUrlUtility

Inherits:
Object
  • Object
show all
Defined in:
app/lib/applicants/video_url_utility.rb

Instance Method Summary collapse

Constructor Details

#initialize(video_url) ⇒ VideoUrlUtility

Returns a new instance of VideoUrlUtility.



4
5
6
# File 'app/lib/applicants/video_url_utility.rb', line 4

def initialize(video_url)
  @video_url = video_url
end

Instance Method Details

#remove!Object



22
23
24
# File 'app/lib/applicants/video_url_utility.rb', line 22

def remove!
  Aws::S3::Object.new(bucket, key, client: client).delete
end

#strip_paramsObject



8
9
10
# File 'app/lib/applicants/video_url_utility.rb', line 8

def strip_params
  @video_url.split("?").first
end

#temporary(expires_in_seconds = 3600) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'app/lib/applicants/video_url_utility.rb', line 12

def temporary(expires_in_seconds=3600)
  Aws::S3::Presigner.new(client: client)
    .presigned_url(
      :get_object,
      bucket:     bucket,
      key:        key,
      expires_in: expires_in_seconds
    )
end