Class: Google::Voice::Missed
Instance Method Summary collapse
Methods inherited from Base
#archive, #delete, #finalize, #initialize, #mark
Constructor Details
This class inherits a constructor from Google::Voice::Base
Instance Method Details
#missed ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/google/voice/missed.rb', line 8 def missed @curb.url = "https://www.google.com/voice/inbox/recent/missed/" @curb.http_get calls = [] doc = Nokogiri::XML::Document.parse(@curb.body_str) box = doc.xpath('/response/json').first.text json = JSON.parse(box) # Format for messages is [id, {attributes}] json['messages'].each do || if [1]['type'].to_i == 2 next else # Google is using milliseconds since epoch for time calls << { :id => [0], :phone_number => [1]['phoneNumber'], :start_time => Time.at([1]['startTime'].to_i / 1000)} end end calls end |