Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
UW Advanced Rails Week 4
Search
Ben Woodall
April 23, 2015
Programming
0
60
UW Advanced Rails Week 4
Ben Woodall
April 23, 2015
Tweet
Share
More Decks by Ben Woodall
See All by Ben Woodall
UW Advanced Rails Week 9
benwoodall
0
34
UW Advanced Rails Week 8
benwoodall
0
42
UW Advanced Rails Week 7
benwoodall
0
40
Week 6
benwoodall
0
40
UW Advanced Rails Week 5
benwoodall
0
47
UW Advanced Rails Week 3
benwoodall
0
63
UW Advanced Rails Week 2
benwoodall
0
87
UW Advanced Rails Week 1
benwoodall
0
93
A Bit More Git
benwoodall
1
5k
Other Decks in Programming
See All in Programming
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
870
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
4
380
Try creating your own orderedmap
kazamori
1
190
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
310
"config" ってなんだ? / What is "config"?
okashoi
0
310
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
360
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
530
Elm 0.19.0 Changes
bkuhlmann
0
510
Snowflakeで眠ったデータを起こそう!
estie
0
140
Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition | AndroidMakers Paris
prof18
0
150
Featured
See All Featured
Infographics Made Easy
chrislema
238
18k
Statistics for Hackers
jakevdp
790
220k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Testing 201, or: Great Expectations
jmmastey
30
6.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
188
16k
A Modern Web Designer's Workflow
chriscoyier
689
190k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Fireside Chat
paigeccino
22
2.6k
How to train your dragon (web standard)
notwaldorf
75
5.2k
Building Effective Engineering Teams - LeadDev
addyosmani
31
1.9k
Being A Developer After 40
akosma
66
580k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
Transcript
Questions from Week 3? 1
Week 4: Building APIs Spring 2015 2
Why an API? Allow other applications to interface with our
services Useful for data driven development 3
REST API Data Formats JSON JavaScript Object Notation MIME type:
application/json XML Extensible Markup Language MIME type: application/xml and text/xml 4
JSON Example { "shorturl": "lf64kr", "user": { "id": 2, "name":
"benwoodall", "email": "
[email protected]
" }, "array": [1,3,5,7] } 5
XML Example <?xml version="1.0" encoding="UTF-8" ?> <root> <shorturl>lf64kr</shorturl> <user> <id>2</id>
<name>benwoodall</name> <email>
[email protected]
</email> </user> <array>1</array> <array>3</array> <array>5</array> <array>7</array> </root> 6
Building an API in Shortener 7
We need an API end-point to create short urls Requests
should be authenticated against 8 What do we know so far?
Tests 9 spec/controllers/api/v1/links_controller_spec.rb
respond_to 10
respond_to 11
Namespacing 12 config/routes.rb
Namespacing 13 config/routes.rb app/controllers/api/base_controller.rb
Namespacing 14 config/routes.rb app/controllers/api/base_controller.rb app/controllers/api/v1/links_controller.rb
Testing 15 spec/controllers/api/v1/links_controller_spec.rb
Creating a Link 16 app/controllers/api/v1/links_controller.rb
Authenticating 17 app/controllers/api/base_controller.rb
Authenticating 18
Authenticating 19
Authenticating 20 app/models/user.rb
Views 21 app/views/settings/index.html.erb
JBuilder 22 app/views/api/v1/links/show.html.erb
Questions? 23