Class: Maglev::PersistSectionScreenshot

Inherits:
Object
  • Object
show all
Includes:
Injectable
Defined in:
app/services/maglev/persist_section_screenshot.rb

Overview

Used to create a screenshot of a section from the Maglev admin UI.

Instance Method Summary collapse

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/services/maglev/persist_section_screenshot.rb', line 16

def call
  return false if base64_image.blank?

  image_data = Base64.decode64(
    base64_image['data:image/png;base64,'.length..]
  )

  persist_file(image_data)

  section.screenshot_timestamp = Time.now.to_i

  true
end