lib/zenvia/sms.rb in zenvia-rb-0.0.8 vs lib/zenvia/sms.rb in zenvia-rb-0.0.9
- old
+ new
@@ -31,9 +31,11 @@
private
def self.send_sms
# convert number to string (if isn't yet) and insert the country code (standard: BR, 55)
# if not found
@number = @number.to_s unless @number.is_a? String
+ patterns = ['(', ')', ' ', '-']
+ patterns.each {|p| @number = @number.gsub(p, '')}
@number.insert(0, '55') unless /^55/.match(@number)
# retrieve auth value set in Config class
@auth = Zenvia.config.auth
endpoint = 'https://api-rest.zenvia360.com.br/services/send-sms'
HTTParty.post(endpoint,
\ No newline at end of file