Skip to content

Conversation

@drippdropp
Copy link
Contributor

In the process of building a custom syncing solution for my company's proprietary CRM and Pardot, I found that I needed to use ProspectAccounts but the ruby-pardot API did not support this object yet, so here it is. We are currently using this code in our version successfully running Ruby v.2.0.0p353 and Ruby v.2.1.1.

Changes:

  • Modified lib/ruby-pardot.rb to add require for new ProspectAccounts class.
  • Modified lib/pardot/client.rb to add include for Objects::ProspectAccounts.
  • Created new file lib/pardot/objects/prospect_accounts.rb which follows the format of Prospects for the most part, albeit directed towards ProspectAccounts. I verified the methods for ProspectAccounts via the Pardot API documentation.

Minor Differences:

  • Used define_method to DRY the code.
  • Used **options instead of options={} (note: double-splat support became available in Ruby 2.x, so for backwards compatibility, it may be preferable to use standard argument defaults instead of double-splat.)

@znbailey
Copy link
Contributor

This looks really good. Two requests:

  • If easy to do so, please change the double-splat to defaults so we can maintain support for Ruby 1.x
  • Please add a spec for the new object under spec/pardot/objects

Thanks!

@znbailey znbailey mentioned this pull request Jul 28, 2014
@drippdropp
Copy link
Contributor Author

No problem, I'll push up the spec and the change to arg defaults tomorrow morning.

@drippdropp
Copy link
Contributor Author

I just added the spec and I fixed a couple things with methods my app doesn't use and I mixed up with the documentation. It's all set now and the spec runs proper. I wrote specs for query, create, and read.

@znbailey
Copy link
Contributor

Thanks, Daniel! @dcunning can you give this a glance and let me know if it looks good to you as well?

@dcunning
Copy link
Contributor

dcunning commented Aug 1, 2014

👍

znbailey added a commit that referenced this pull request Aug 1, 2014
@znbailey znbailey merged commit 3c468a5 into pardot:master Aug 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants