Upgrade to Pro — share decks privately, control downloads, hide ads and more …

future-proofing your 3rd party integrations - Rocky Mountain Ruby 2014

future-proofing your 3rd party integrations - Rocky Mountain Ruby 2014

The adapter pattern using gems, dtos, and communication.

Jeffrey Matthias

September 25, 2014
Tweet

More Decks by Jeffrey Matthias

Other Decks in Programming

Transcript

  1. goals • keep 3rd party logic out of our code

    • make 3rd party behavior predictable • make 3rd party replaceable
  2. • package vs ‘product rate plan’ • add_on vs ‘product

    rate plan’ • coupon vs ‘product rate plan charge’
  3. • PackageService handles ‘product rate plan’ • AddOnService handles ‘product

    rate plan’ • CouponService handles ‘product rate plan charge’
  4. testing is good • never assume data exists in your

    3rd party • use a sandbox if one is available
  5. always never forget • cassettes must be delete-able • make

    sure you set up everything you need • CI: kill your cassettes. A lot.
  6. recap • define your vocabulary • create an adapter interface

    gem(DTOs and abstract services) • create an adapter gem (and add uptyped) • create a test environment • use VCR • delete your cassettes!!! A lot!!!!!