Class: Snapcat::Media
- Inherits:
-
Object
- Object
- Snapcat::Media
- Defined in:
- lib/snapcat/media.rb
Defined Under Namespace
Classes: Type
Instance Method Summary collapse
- #file_extension ⇒ Object
- #generate_id(username) ⇒ Object
- #image? ⇒ Boolean
-
#initialize(data, type_code = nil) ⇒ Media
constructor
A new instance of Media.
- #to_s ⇒ Object
- #type_code ⇒ Object
- #video? ⇒ Boolean
Constructor Details
Instance Method Details
#file_extension ⇒ Object
8 9 10 |
# File 'lib/snapcat/media.rb', line 8 def file_extension @type.file_extension end |
#generate_id(username) ⇒ Object
16 17 18 |
# File 'lib/snapcat/media.rb', line 16 def generate_id(username) "#{username.upcase}~#{Timestamp.macro}" end |
#image? ⇒ Boolean
12 13 14 |
# File 'lib/snapcat/media.rb', line 12 def image? @type.image? end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/snapcat/media.rb', line 20 def to_s @data end |
#type_code ⇒ Object
24 25 26 |
# File 'lib/snapcat/media.rb', line 24 def type_code @type.code end |
#video? ⇒ Boolean
28 29 30 |
# File 'lib/snapcat/media.rb', line 28 def video? @type.video? end |