unlock dependency between client teams and api team with api mock and proxy

15
Unlock dependency between client teams and API team with API mock and proxy Bruce Li @ascendbruce Rails Pacific 2016

Upload: bruce-li

Post on 21-Feb-2017

234 views

Category:

Engineering


6 download

TRANSCRIPT

Page 1: Unlock dependency between client teams and API team with API mock and proxy

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

Bruce Li @ascendbruce

Rails Pacific 2016 ⚡

Page 2: Unlock dependency between client teams and API team with API mock and proxy

API Implementation Code Review Deploy QA

API Implementation Code Review Deploy QA

Web Client Implementation

Android APP Implementation

iOS App Implementation

API design

change

Page 3: Unlock dependency between client teams and API team with API mock and proxy
Page 4: Unlock dependency between client teams and API team with API mock and proxy

### 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]

Page 5: Unlock dependency between client teams and API team with API mock and proxy

]

### 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",

Page 6: Unlock dependency between client teams and API team with API mock and proxy

+ 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 } ] }

Page 7: Unlock dependency between client teams and API team with API mock and proxy

"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

Page 8: Unlock dependency between client teams and API team with API mock and proxy
Page 9: Unlock dependency between client teams and API team with API mock and proxy

specific behavior to be tested?

Page 10: Unlock dependency between client teams and API team with API mock and proxy

DEMO

Page 11: Unlock dependency between client teams and API team with API mock and proxy

iOS Client

API Mock

Web Client

Android Client

Sandbox

Page 12: Unlock dependency between client teams and API team with API mock and proxy

iOS Client

API endpoint

Web Client

Android Client

Your backend

Page 13: Unlock dependency between client teams and API team with API mock and proxy

iOS Client

API Mock

API endpoint

Web Client

Android Client

DEMO

Sandbox

Your backend

Page 14: Unlock dependency between client teams and API team with API mock and proxy

Awesome-ize rails console in 3 steps

1. gem 'awesome_rails_console'

2. bundle install

3. rails g awesome_rails_console:install

DEMO

Page 15: Unlock dependency between client teams and API team with API mock and proxy

@ascendbruce

toyroom.bruceli.net

Thank you

We’re hiring

Tweet me your feedback

Blog post version of this talk is coming soon