I have a Rails application that allows users to buy and use phone numbers (via Twilio) for marketing campaigns.
Currently, when they navigate to the 'calls' section of the app, I'm making live API calls to Twilio to retrieve all their call data for a specific number (to, from, duration,etc.). While this works ok for 20 or so users, I know its not a long term solution.
I'd like to grab the necessary data from a callback once each phone call ends and store it in a model or use a worker to go out and pull down all the call info at the end of each day and save it to a model.
What would be the best way to store this data? Let's assume a number gets 200 calls a day (they range from 20-400+ calls/day).
I don't think I should create a separate record for each of those 200 calls each day (please correct me if I'm wrong in thinking that).
I was thinking of creating a serialized text column in a table that would store a hash of hashes with all the calls and call info for each number but is that ok to have a hash of hashes that large?
Ex.
calls = {:"800-123-6798"=>{:to=>415-111-0000, :from=>415-111-2222, :duration=>240}, :"800-123-6798"=>{:to=>415-222-0000, :from=>415-222-3456, :duration=>345}
Am I missing a better solution?