class Redox::Models::Media

Constants

BLOB_REQUIRED_SIZE

Public Instance Methods

add_filepath(path) click to toggle source
# File lib/redox/models/media.rb, line 33
def add_filepath(path)
  if File.size(path) > BLOB_REQUIRED_SIZE
    raise 'Not implemented'
  else
    self.file_contents = Base64::encode64(File.read(path))
    self.file_type     = "#{File.extname(path)}".delete_prefix('.').upcase
    self.file_name     = File.basename(path, '.*')
  end
end
availability=(value) click to toggle source
# File lib/redox/models/media.rb, line 22
def availability=(value)
  case value
  when true
    self[:Availability] = 'Available'
  when false
    self[:Availability] = 'Unavailable'
  else
    self[:Availability] = value
  end
end