mneedham91 / PyPardot4

PyPardot is a wrapper for Version 4 of the Pardot API, written in Python.
MIT License
48 stars 38 forks source link

separate the implementations between ver. 3 and 4 #43

Open daigotanaka opened 4 years ago

daigotanaka commented 4 years ago

(redo pr: the previous #42 was opened with my master branch.)

As some people reported in #38, Pardot API resources of ver 3 and 4 have different interfaces while the authentications and the URL format are the same. So, I suggest separating the implementations in the design just as in this pr.

With this design, we will be able to:

  1. Instantiate PyPardot client by specifying version
    p = PardotAPI(email='some@example.com', password='xxxx', user_key='yyyy', version=3)
    # defaults to 4
  2. Load different methods:
    p.prospects.update_by_email('some@example.com', params)   # Only supported with ver. 3
  3. Update the implementation of one version without a fear of breaking another.

I hope you can take a look and consider it.

Most files added in this PR are straight import from Josh Geller's original implementation under object_v3 folder. The modifications are for allowing a run-time switch.