Unlock dependency between client teams and API team with API mock and proxy
Bruce Li @ascendbruce
Rails Pacific 2016 ⚡
API Implementation Code Review Deploy QA
API Implementation Code Review Deploy QA
Web Client Implementation
Android APP Implementation
iOS App Implementation
API design
change
### 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 } ] } ]
### Create a New Question [POST]
]
### 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?", "published_at": "2014-11-11T08:40:51.620Z",
+ 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 } ] }
"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 } ] }
AND 9,000+ LINES
specific behavior to be tested?
DEMO
iOS Client
API Mock
Web Client
Android Client
Sandbox
iOS Client
API endpoint
Web Client
Android Client
Your backend
iOS Client
API Mock
API endpoint
Web Client
Android Client
DEMO
Sandbox
Your backend
Awesome-ize rails console in 3 steps
1. gem 'awesome_rails_console'
2. bundle install
3. rails g awesome_rails_console:install
DEMO
@ascendbruce
toyroom.bruceli.net
Thank you
We’re hiring
Tweet me your feedback
Blog post version of this talk is coming soon