Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Unlock dependency between client teams and API team with API mock and proxy

340 views

Published on

Use sandbox (getsandbox.com) to write javascript API mocks. Write a small lib to proxy app client requests to API mock. So that app client teams don't need to wait until API is done and deployed.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Unlock dependency between client teams and API team with API mock and proxy

  1. 1. Unlock dependency between client teams and API team with API mock and proxy Bruce Li @ascendbruce Rails Pacific 2016 ⚡
  2. 2. API Implementation Code Review DeployQA API Implementation Code Review DeployQA Web Client Implementation Android APP Implementation iOS App Implementation API design change
  3. 3. ### List All Questions [GET] + Response 200 (application/json) [ { "question": "Favourite programming language?", "published_at": "2014-11-11T08:40:51.620Z", "url": "/questions/1", "choices": [ { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 2048 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 1024 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 512 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 256 } ] } ]
  4. 4. ] ### Create a New Question [POST] You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices. + question (string) - The question + choices (array[string]) - A collection of choices. + Request (application/json) { "question": "Favourite programming language?", "choices": [ "Swift", "Python", "Objective-C", "Ruby" ] } + Response 201 (application/json) + Headers Location: /questions/1 + Body { "question": "Favourite programming language?",
  5. 5. + Response 201 (application/json) + Headers Location: /questions/1 + Body { "question": "Favourite programming language?", "published_at": "2014-11-11T08:40:51.620Z", "url": "/questions/1", "choices": [ { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 0 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 0 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 0 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 0 } ] }
  6. 6. { "choice": "Swift", "url": "/questions/1/choices/1", "votes": 0 }, { "choice": "Python", "url": "/questions/1/choices/2", "votes": 0 }, { "choice": "Objective-C", "url": "/questions/1/choices/3", "votes": 0 }, { "choice": "Ruby", "url": "/questions/1/choices/4", "votes": 0 } ] } AND 9,000+ LINES
  7. 7. specific behavior to be tested?
  8. 8. DEMO
  9. 9. iOS Client API Mock Web Client Android Client Sandbox
  10. 10. iOS Client API endpoint Web Client Android Client Your backend
  11. 11. iOS Client API Mock API endpoint Web Client Android Client DEMO Sandbox Your backend
  12. 12. Awesome-ize rails console in 3 steps 1. gem 'awesome_rails_console' 2. bundle install 3. rails g awesome_rails_console:install DEMO
  13. 13. @ascendbruce toyroom.bruceli.net Thank you We’re hiring Tweet me your feedback Blog post version of this talk is coming soon

×