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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ben Woodall
April 23, 2015
Programming
0
72
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
44
UW Advanced Rails Week 8
benwoodall
0
51
UW Advanced Rails Week 7
benwoodall
0
47
Week 6
benwoodall
0
51
UW Advanced Rails Week 5
benwoodall
0
57
UW Advanced Rails Week 3
benwoodall
0
70
UW Advanced Rails Week 2
benwoodall
0
190
UW Advanced Rails Week 1
benwoodall
0
100
A Bit More Git
benwoodall
1
5.1k
Other Decks in Programming
See All in Programming
PHP でエミュレータを自作して Ubuntu を動かそう
m3m0r7
PRO
2
140
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
1.1k
KagglerがMixSeekを触ってみた
morim
0
290
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
230
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.4k
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
230
安いハードウェアでVulkan
fadis
1
790
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
160
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
550
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
800
Rethinking API Platform Filters
vinceamstoutz
0
620
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
240
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
270
Crafting Experiences
bethany
1
94
Designing Experiences People Love
moore
143
24k
Site-Speed That Sticks
csswizardry
13
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
840
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
240
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
490
WENDY [Excerpt]
tessaabrams
9
37k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
330
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
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