Upload files to 'lib/postman'
This commit is contained in:
parent
51395d835a
commit
ad74632897
31
lib/postman/attachment.rb
Normal file
31
lib/postman/attachment.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
require 'base64'
|
||||||
|
|
||||||
|
module Postman
|
||||||
|
class Attachment
|
||||||
|
|
||||||
|
def initialize(attributes)
|
||||||
|
@attributes = attributes
|
||||||
|
end
|
||||||
|
|
||||||
|
def filename
|
||||||
|
@attributes['filename']
|
||||||
|
end
|
||||||
|
|
||||||
|
def content_type
|
||||||
|
@attributes['content_type']
|
||||||
|
end
|
||||||
|
|
||||||
|
def size
|
||||||
|
@attributes['size']
|
||||||
|
end
|
||||||
|
|
||||||
|
def hash
|
||||||
|
@attributes['hash']
|
||||||
|
end
|
||||||
|
|
||||||
|
def data
|
||||||
|
@data ||= Base64.decode64(@attributes['data'])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user