Пример #1
0
 def build(self):
     phonebook = Phonebook()
     for record in self.json_data:
         contact = Contact(record['name'], record['surname'])
         phonebook.add_contact(contact)
         for number in record['numbers']:
             contact.add_new_number(number['phone_number'],
                                    number['phone_type'])
     return phonebook
Пример #2
0
 def _build_contact(self):
     contact = Contact(self.name, self.surname)
     contact.add_new_number(self.phone_number, self.phone_type)
     return True, contact