-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create client class to include all migration methods, refactor code, …
…add function header comments to client methods
- Loading branch information
Bruno
committed
Oct 29, 2023
1 parent
a1ff375
commit aff1040
Showing
3 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from .classes.migration import Migrate | ||
|
||
print("Hello World!") | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from .classes.migration import Migrate | ||
|
||
class MigrationClient: | ||
def __init__(self, config, hubspot): | ||
self.migrate = Migrate(dict, config, hubspot) | ||
|
||
|
||
# Migrate contacts | ||
def migrate_contact(self, data): | ||
""" Migrate contact to HubSpot | ||
Arguments: | ||
data {dict} -- Data to migrate to HubSpot | ||
""" | ||
return self.migrate.post_data(data, 'contacts') | ||
|
||
def update_contact(self, data, contact_id): | ||
""" Update contact in HubSpot | ||
Areguments: | ||
data {dict} -- Data to update in HubSpot | ||
contact_id {str} -- ID of the contact to update | ||
""" | ||
return self.migrate.put_data(data, contact_id, 'contacts') | ||
|
||
def delete_contact(self, contact_id): | ||
""" Delete contact in HubSpot | ||
Arguments: | ||
contact_id {str} -- ID of the contact to delete | ||
""" | ||
return self.migrate.delete_data(contact_id, 'contacts') | ||
|
||
|
||
# Migrate companies | ||
def migrate_company(self, data): | ||
""" Migrate company to HubSpot | ||
Arguments: | ||
data {dict} -- Data to migrate to HubSpot | ||
""" | ||
return self.migrate.post_data(data, 'companies') | ||
|
||
def update_company(self, data, company_id): | ||
""" Update company in HubSpot | ||
Areguments: | ||
data {dict} -- Data to update in HubSpot | ||
company_id {str} -- ID of the company to update | ||
""" | ||
return self.migrate.put_data(data, company_id, 'companies') | ||
|
||
def delete_company(self, company_id): | ||
""" Delete company in HubSpot | ||
Arguments: | ||
company_id {str} -- ID of the company to delete | ||
""" | ||
return self.migrate.delete_data(company_id, 'companies') | ||
|
||
|