Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LRUG_-api.pdf
Search
Michał Brodecki
December 10, 2015
31
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LRUG_-api.pdf
Michał Brodecki
December 10, 2015
More Decks by Michał Brodecki
See All by Michał Brodecki
Debugging rails
mbroderson
0
24
LRUG 22.06.2016
mbroderson
0
42
Featured
See All Featured
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
The SEO Collaboration Effect
kristinabergwall1
1
590
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
The Cult of Friendly URLs
andyhume
79
7k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
310
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Transcript
API w Ruby on Rails
Przed wyruszeniem w drogę należy odchudzić drużynę.
gem „rails-api”
gem „rails-api”
Kolejna warstwa magicznych rzeczy Make ApplicationController inherit from ActionController::API instead
of ActionController::Base. Configure the generators to skip generating views, helpers and assets when you generate a new resource.
# config/application.rb # require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" #
require "sprockets/railtie" require "rails/test_unit/railtie"
Tylko apka mobilna?
Apka mobilna i apka webowa ?
Tylko apka webowa ?
Rspec + FactoryGirl Testowanie aplikacji
Co testować, jak testować ?
Requests
Modele relacje walidacje metody (kolejność nieprzypadkowa)
Dokumentacja apipie rspec api documentation Rdoc rspec api blueprint swagger
Serializowanie danych
Active Model Serializers
app/serializers/conversation_serializer.rb
Wersjonowanie api i namespace’y api/v1/…. api/v2/….
Jak najmniejsze kontrolery. dużo logiki => serwis
None
None
Nie wszystko natychmiast ! Nie bądź pazerny ! sidekiq maile
notyfikacje cała reszta, która nie ma znaczenia przy wysyłaniu requestu
Autentykacja poprzez API
simple token authentication devise token auth tiddle
Format błędów i statusy 200 OK 201 Created (success) 400
bad request 401 unauthorized 500 :<
Zabezpieczenie API Basic auth SSL Sprawdzanie wersji api (np. w
headerach)
None
Dzięki !