class Snapcat::Media

Public Class Methods

new(data, type_code = nil) click to toggle source
# File lib/snapcat/media.rb, line 3
def initialize(data, type_code = nil)
  @data = Crypt.decrypt(data)
  @type = Type.new(code: type_code, data: @data)
end

Public Instance Methods

file_extension() click to toggle source
# File lib/snapcat/media.rb, line 8
def file_extension
  @type.file_extension
end
generate_id(username) click to toggle source
# File lib/snapcat/media.rb, line 16
def generate_id(username)
  "#{username.upcase}~#{Timestamp.macro}"
end
image?() click to toggle source
# File lib/snapcat/media.rb, line 12
def image?
  @type.image?
end
to_s() click to toggle source
# File lib/snapcat/media.rb, line 20
def to_s
  @data
end
type_code() click to toggle source
# File lib/snapcat/media.rb, line 24
def type_code
  @type.code
end
video?() click to toggle source
# File lib/snapcat/media.rb, line 28
def video?
  @type.video?
end