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
75
0
Share
UW Advanced Rails Week 4
Ben Woodall
April 23, 2015
More Decks by Ben Woodall
See All by Ben Woodall
UW Advanced Rails Week 9
benwoodall
0
47
UW Advanced Rails Week 8
benwoodall
0
55
UW Advanced Rails Week 7
benwoodall
0
52
Week 6
benwoodall
0
59
UW Advanced Rails Week 5
benwoodall
0
63
UW Advanced Rails Week 3
benwoodall
0
76
UW Advanced Rails Week 2
benwoodall
0
210
UW Advanced Rails Week 1
benwoodall
0
110
A Bit More Git
benwoodall
1
5.1k
Other Decks in Programming
See All in Programming
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.2k
AIエージェントの隔離技術の徹底比較
kawayu
0
440
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
190
新規プロダクトを高速で生み出すハーネスエンジニアリング
seanchas116
15
7.2k
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
3
1.3k
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
220
Inspired By RubyKaigi (EN)
atzzcokek
0
390
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
310
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
490
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
190
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.8k
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
940
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Designing for Performance
lara
611
70k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Site-Speed That Sticks
csswizardry
13
1.2k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
750
Navigating Team Friction
lara
192
16k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
370
Un-Boring Meetings
codingconduct
0
300
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