Remove support for string datetime in SMS

develop
Guillaume DOTT 2013-09-10 15:56:14 +02:00
parent f4218e1025
commit ff6dc617dc
2 changed files with 4 additions and 16 deletions

View File

@ -2,8 +2,7 @@ require 'date'
module Biju module Biju
class Sms class Sms
attr_accessor :id, :phone_number, :type_of_address, :message attr_reader :id, :phone_number, :type_of_address, :message, :datetime
attr_reader :datetime
def self.from_pdu(string, id = nil) def self.from_pdu(string, id = nil)
sms_infos = PDU.decode(string) sms_infos = PDU.decode(string)
@ -16,21 +15,10 @@ module Biju
def initialize(params = {}) def initialize(params = {})
params.each do |attr, value| params.each do |attr, value|
self.public_send("#{attr}=", value) instance_variable_set(:"@#{attr}", value)
end if params end if params
end end
def datetime=(arg)
@datetime = case arg
when String
DateTime.strptime(arg, "%y/%m/%d,%T%Z")
when DateTime
arg
else
nil
end
end
def to_s def to_s
"[#{id}] (#{phone_number}) #{datetime} '#{message}'" "[#{id}] (#{phone_number}) #{datetime} '#{message}'"
end end

View File

@ -1,3 +1,3 @@
module Biju module Biju
VERSION = "0.0.2" VERSION = '0.0.2'
end end