Allow for an id or an enumerable for Biju::Hayes#delete

develop
Guillaume DOTT 2013-10-03 11:11:21 +02:00
parent 77105b180a
commit 3656fd6d82
1 changed files with 7 additions and 1 deletions

View File

@ -105,7 +105,13 @@ module Biju
# Delete a sms message by id. # Delete a sms message by id.
# @param [Fixnum] Id of sms message on modem. # @param [Fixnum] Id of sms message on modem.
def delete(id) def delete(id)
at_command('+CMGD', id) id = [id] if id.kind_of?(Fixnum)
return unless id.kind_of?(Enumerable)
res = true
id.each { |i| res &= at_command('+CMGD', i)[:status] }
res
end end
def send(sms, options = {}) def send(sms, options = {})