0
votes

After finishing Michael Hartl's tutorial on Rails, my first pet project is building a call tracking app using the Twilio API. The basic idea is the following -

There are 4 plans users can sign up for, which limit the number of phone numbers they have, and the number of minutes they can use

Each user, once registered gets their own subaccount from Twilio

Each user can buy phone numbers, limited to their plan

Each user can track what's happening on their phone numbers.

Right now, I've build a basic authorization system, and brainstormed a potential data structure. I have huge loop holes in understanding though, so an experienced programmer's eyes would be greatly appreciated. I.e is there a better data structure, does what I outline below even make sense?

---So, here's the data structure

Table : Plans

max_phone_numbers: integer 
max_minutes: integer
has_many: users 

Table : Users

name:string
email:string
password_digest:string
remember_token:string [For log in system]
Twilio_SubAccountSid: string
Twilio_SubAccountAuthToken: string
Plan id : integer [to connect to plan] 
stripe_token : string [for charging]
belongs_to: plan
has_many: phone_numbers

Table : Phone Numbers

belongs_to users
phone_number:string
user_id: integer
has_many: data_points

Table : Twilio Data

belongs_to phone_numbers
phone_number_id: string
[All of Twilio's call tracking data..i.e duration of call, location etc.]

Okay, that's pretty much my interpration of how it might work. Please tear it apart!

1

1 Answers

0
votes

In terms of the data structure, I think this seems to be it. What I didn't realize though is that there's a lot more controllers involved. For example, searching and buying in Twilio involved two CREATE actions, so I had to make another controller. I imagine there would be another controller that would be responsible for routing calls.