Feature: Twilio Whatsapp Integration (#779)

Twilio Whatsapp Integration

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2020-04-30 01:41:13 +05:30
committed by GitHub
parent 168042f9a4
commit 0cb7333977
23 changed files with 238 additions and 81 deletions

View File

@@ -1,8 +1,9 @@
class LocalResource
attr_reader :uri
def initialize(uri)
def initialize(uri, file_type = nil)
@uri = URI(uri)
@file_type = file_type
end
def file
@@ -23,11 +24,12 @@ class LocalResource
io.read.encoding
end
def find_file_type
@file_type ? @file_type.split('/').last : Pathname.new(uri.path).extname
end
def tmp_filename
[
Time.now.to_i.to_s,
Pathname.new(uri.path).extname
]
[Time.now.to_i.to_s, find_file_type].join('.')
end
def tmp_folder