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

RubyConf 2013 Futureproofing your 3rd party integrations

RubyConf 2013 Futureproofing your 3rd party integrations

A compilation of practices, used by the Portal team @sendgrid, for implementing 3rd party services with future flexibility in mind.

Jeffrey Matthias

November 18, 2014
Tweet

More Decks by Jeffrey Matthias

Other Decks in Technology

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 • observe the 4 steps of testing

    • never assume data exists in your 3rd party • use a sandbox if one is available
  5. always never forget • stubbed service MUST be maintained •

    make sure you set up everything you need • CI: hit the sandbox
  6. goals • keep 3rd party logic out of our code

    • make 3rd party behavior predictable
  7. goals • keep 3rd party logic out of our code

    • make 3rd party behavior predictable • make 3rd party replaceable
  8. recap • define your vocabulary • create an adapter interface

    gem(DTOs and abstract services) • create an adapter gem (and add uptyped) • create a test environment • stub your 3rd party for development • maintain your stub/fake!!!!