lib/smess/outputs/smsglobal.rb in smess-2.3.0 vs lib/smess/outputs/smsglobal.rb in smess-3.0.0
- old
+ new
@@ -35,13 +35,13 @@
maxsplit: "3"
}
end
def normal_result(response)
- first_response = response.body.split(/\r\n/).first.split(";")
- response_code = first_response.first.split(':').last.to_i
- message_id = first_response.last.split('SMSGlobalMsgID:').last
+ first_response = response.body.split(/\r\n/).first.split(";") rescue nil
+ response_code = first_response.first.split(':').last.to_i rescue response.code.to_s
+ message_id = first_response.last.split('SMSGlobalMsgID:').last rescue ""
# Successful response
{
message_id: message_id,
response_code: response_code.to_s,
response: response.body,
@@ -49,6 +49,6 @@
data: result_data
}
end
end
-end
\ No newline at end of file
+end