Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Nation Builder Connector #837

Merged
merged 15 commits into from
Jun 26, 2023

Conversation

gcollazo
Copy link
Contributor

@gcollazo gcollazo commented Jun 6, 2023

This PR adds a new Nation Builder connector.

The connector implements the following public methods:

  • get_people: make all necessary HTTP request to get all people and return a Table. If a request fails, it will wait 30 seconds and keep trying until it fetches everything.
  • update_person: update a person by their Nation Builder id.
  • upsert_person: update or create a person.

Examples

The following examples help illustrate the API usage.

from dotenv import load_dotenv

from parsons.nation_builder.nation_builder import NationBuilder

load_dotenv()

nb = NationBuilder()

# get all people and return a Table
people_table = nb.get_people()
people_table.to_csv("nbexport.csv")

# update person by id
data = {"email": "[email protected]", "tags": ["foo", "bar"]}
updated_person_1 = nb.update_person("123456789", data)

# update or create a person
data = {"email": "[email protected]", "tags": ["dogs", "cats"]}
created, person = nb.upsert_person(data)

if created:
    print("Person created:", person)
else:
    print("Person updated:", person)

@gcollazo gcollazo force-pushed the gcc/nation-builder-connector branch from a1ec55e to 0210775 Compare June 6, 2023 20:19
@gcollazo gcollazo marked this pull request as ready for review June 6, 2023 20:37
@shaunagm shaunagm added the 🎉 first PR the first PR by a new contributor label Jun 6, 2023
Copy link
Collaborator

@shaunagm shaunagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in Slack, this needs documentation (see an example here). Do you know how hard it is to become a certified developer? I'd love to be able to do a live test but if that's too much of a hassle we can figure something else out.

@gcollazo gcollazo force-pushed the gcc/nation-builder-connector branch from 1cc50f9 to 756ee7f Compare June 20, 2023 18:58
@gcollazo
Copy link
Contributor Author

Just added the necessary docs using the ActBlue page as a template. I think it's complete and clear but let me know if something else is needed.

We can schedule a quick call and I can run a few test scenarios using our live NB account. I'm on Slack so you can contact me there to coordinate.

We have not explored becoming certified developers since what we are building is for our own internal use. I have a weekly meeting with NB I will bring that up and let you know.

The CI failure looks unrelated to this PR.

Copy link
Collaborator

@shaunagm shaunagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Giovanni, just making a note that once you add the mock tests, we should be good to merge.

@gcollazo gcollazo requested a review from shaunagm June 22, 2023 20:53
@gcollazo
Copy link
Contributor Author

@shaunagm just added the additional tests using fixtures. Please do let me know if you need additional changes.

Copy link
Collaborator

@shaunagm shaunagm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@shaunagm shaunagm merged commit eb71f60 into move-coop:main Jun 26, 2023
shaunagm added a commit that referenced this pull request Jun 26, 2023
shaunagm added a commit that referenced this pull request Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 first PR the first PR by a new contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants