$30 off During Our Annual Pro Sale. View Details »
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
68
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
40
UW Advanced Rails Week 8
benwoodall
0
48
UW Advanced Rails Week 7
benwoodall
0
44
Week 6
benwoodall
0
46
UW Advanced Rails Week 5
benwoodall
0
54
UW Advanced Rails Week 3
benwoodall
0
66
UW Advanced Rails Week 2
benwoodall
0
170
UW Advanced Rails Week 1
benwoodall
0
96
A Bit More Git
benwoodall
1
5.1k
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
200
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
100
All(?) About Point Sets
hole
0
280
NUMA環境とコンテナランタイム ― youki における Linux Memory Policy 実装
n4mlz
1
160
「文字列→日付」の落とし穴 〜Ruby Date.parseの意外な挙動〜
sg4k0
0
370
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
120
FluorTracer / RayTracingCamp11
kugimasa
0
200
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
150
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
140
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
220
CSC509 Lecture 14
javiergs
PRO
0
220
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
2.9k
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
GitHub's CSS Performance
jonrohan
1032
470k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Writing Fast Ruby
sferik
630
62k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Building Adaptive Systems
keathley
44
2.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
YesSQL, Process and Tooling at Scale
rocio
174
15k
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