SlideShare a Scribd company logo
1 of 37
The Backend Side of the Mobile
Rodrigo Ayala
Desarrollador
Ruby
martes, 4 de junio de 13
@RodrigoAyala
martes, 4 de junio de 13
Most Ruby Devs don’t want
to leave Ruby
martes, 4 de junio de 13
RubyMotion
An Objective-C
implementation of Ruby
Propietary MacRuby fork
USD$199.99
http://www.rubymotion.com/
martes, 4 de junio de 13
Ruboto
JRuby on Android
Open Source
USD$0 - Free as a beer
https://github.com/ruboto/ruboto
martes, 4 de junio de 13
Mobile HTTP
API with Ruby
Ruby Web Framework
Open Source
USD$0 - Free as a beer
http://rubyonrails.org/
http://www.sinatrarb.com/
martes, 4 de junio de 13
Mobile HTTP
API with Ruby
martes, 4 de junio de 13
API Components
for Mobile Apps
martes, 4 de junio de 13
API
User authentication with token
Push Notifications
martes, 4 de junio de 13
API
https://github.com/intridea/grape
Micro framework to develop
REST-like API
Runs on Rack or mounted on
webapp frameworks (Rails,
Sinatra, etc.)
martes, 4 de junio de 13
module Twitter
class API < Grape::API
version 'v1'
format :json
prefix 'api'
end
end
martes, 4 de junio de 13
helpers do
def current_user
@current_user ||= User.authorize!(env)
end
def authenticate!
error!('401 Unauthorized', 401) unless current_user
end
end
martes, 4 de junio de 13
resource :statuses do
desc "Return a personal timeline."
get :home_timeline do
authenticate!
current_user.statuses.limit(20)
end
desc "Create a status."
params do
requires :status, type: String, desc: "Your status."
end
post :tweet do
authenticate!
Status.create!({
user: current_user,
text: params[:status]
})
end
end
martes, 4 de junio de 13
http://myhost.com/api/v1/statuses/home_timeline.json
martes, 4 de junio de 13
martes, 4 de junio de 13
{
"statuses": [{
"id": 1,
"secret_value": "dont disclose",
"content": "hi"
}]
}
martes, 4 de junio de 13
{
"statuses": [{
"id": 1,
"secret_value": "dont disclose",
"content": "hi"
}]
}
martes, 4 de junio de 13
API
https://github.com/LTe/grape-rabl
Allow to use Rabl templates
with Grape
Rabl is a template system to
generate JSON, XML
Grape::Rabl
martes, 4 de junio de 13
module Twitter
class API < Grape::API
version 'v1'
format :json
prefix 'api'
formatter :json, Grape::Formatter::Rabl
resource :statuses do
desc "Return a personal timeline."
get :home_timeline , :rabl => "user" do
authenticate!
@statuses = current_user.statuses.limit(20)
end
end
end
end
Grape::Rabl
martes, 4 de junio de 13
# status.rabl
object @statuses => :statuses
attributes :content
Grape::Rabl
martes, 4 de junio de 13
Grape::Rabl
{
"statuses": [{
"id": 1,
"secret_value": "dont disclose",
"content": "hi"
}]
}
martes, 4 de junio de 13
{
"statuses": [{
"content": "hi"
}]
}
Grape::Rabl
martes, 4 de junio de 13
martes, 4 de junio de 13
User authentication with Token
https://github.com/plataformatec/devise
Flexible authentication for
Rails
martes, 4 de junio de 13
Token Authenticable
martes, 4 de junio de 13
Devise - Token Authenticable
def authenticated
if warden.authenticated?
@current_user = current_user
return true
elsif params[:auth_token] and @current_user =
User.find_by_authentication_token(params[:auth_token])
return true
else
error!('401 Unauthorized', 401)
end
end
martes, 4 de junio de 13
martes, 4 de junio de 13
Push Notifications
Allow to send Apple Push
Notifications (iOS)
https://github.com/jpoz/apns
APNS
martes, 4 de junio de 13
APNS - Push Notifications
$ openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
martes, 4 de junio de 13
APNS - Push Notifications
APNS.host = 'gateway.push.apple.com'
# gateway.sandbox.push.apple.com is default
APNS.pem = '/path/to/pem/file'
# this is the file you just created
# Dir.pwd+”/cert.pem” if you have the certificate on the root
APNS.port = 2195
# this is also the default. Shouldn't ever have to set this, but
just in case Apple goes crazy, you can.
martes, 4 de junio de 13
APNS - Push Notifications
device_token = '123abc456def'
APNS.send_notification(device_token, 'Hello iPhone!' )
APNS.send_notification(device_token, :alert => 'Hello iPhone!',
:badge => 1, :sound => 'default')
martes, 4 de junio de 13
APNS - Push Notifications
martes, 4 de junio de 13
Push Notifications
Allow to send push
notifications to Android
phones via Google Cloud
Messaging
GCM
https://github.com/spacialdb/gcm
martes, 4 de junio de 13
APNS - Push Notifications
gcm = GCM.new("GCM_PRIVATE_KEY")
options = {:data=> {:ticker=> "mini title",
:title => "title",
:message => "full message",
:custom => custom
}
}
gcm.send_notification([device_token], options)
martes, 4 de junio de 13
APNS - Push Notifications
martes, 4 de junio de 13
martes, 4 de junio de 13
Gracias!
martes, 4 de junio de 13

More Related Content

Viewers also liked (11)

HTBYOOFIYRHT RubyConf
HTBYOOFIYRHT RubyConfHTBYOOFIYRHT RubyConf
HTBYOOFIYRHT RubyConf
 
Rails Metal, Rack, and Sinatra
Rails Metal, Rack, and SinatraRails Metal, Rack, and Sinatra
Rails Metal, Rack, and Sinatra
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Restful API On Grape
Restful API On GrapeRestful API On Grape
Restful API On Grape
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)
 
Rapid-ruby-api-on-grape
Rapid-ruby-api-on-grapeRapid-ruby-api-on-grape
Rapid-ruby-api-on-grape
 
Sinatra Introduction
Sinatra IntroductionSinatra Introduction
Sinatra Introduction
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
API Performance
API PerformanceAPI Performance
API Performance
 

Similar to The Backend Side of the Mobile

Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
cordoval
 
Frozen Rails Slides
Frozen Rails SlidesFrozen Rails Slides
Frozen Rails Slides
carllerche
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
Michele Orru
 

Similar to The Backend Side of the Mobile (20)

Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache Sling
 
Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013
 
Riding on rails3 with full stack of gems
Riding on rails3 with full stack of gemsRiding on rails3 with full stack of gems
Riding on rails3 with full stack of gems
 
Laravel sdphp
Laravel sdphpLaravel sdphp
Laravel sdphp
 
Intro to Laravel 4 : By Chris Moore
Intro to Laravel 4 : By Chris Moore Intro to Laravel 4 : By Chris Moore
Intro to Laravel 4 : By Chris Moore
 
EdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal againEdTechJoker Spring 2020 - Lecture 8 Drupal again
EdTechJoker Spring 2020 - Lecture 8 Drupal again
 
Servicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoServicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyecto
 
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
 
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
Workshop KrakYourNet2016 - Web applications hacking Ruby on Rails example
 
RoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails exampleRoR Workshop - Web applications hacking - Ruby on Rails example
RoR Workshop - Web applications hacking - Ruby on Rails example
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 
RESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionRESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an Introduction
 
Frozen Rails Slides
Frozen Rails SlidesFrozen Rails Slides
Frozen Rails Slides
 
Ruby - The Hard Bits
Ruby - The Hard BitsRuby - The Hard Bits
Ruby - The Hard Bits
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
Introduction to Social APIs
Introduction to Social APIsIntroduction to Social APIs
Introduction to Social APIs
 
HowYourAPIBeMyAPI
HowYourAPIBeMyAPIHowYourAPIBeMyAPI
HowYourAPIBeMyAPI
 
Experiments in Data Portability 2
Experiments in Data Portability 2Experiments in Data Portability 2
Experiments in Data Portability 2
 
One Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web AppOne Page, One App -or- How to Write a Crawlable Single Page Web App
One Page, One App -or- How to Write a Crawlable Single Page Web App
 

More from Rodrigo Ayala

Workshop DSL 2011 - Desarrollo jQuery
Workshop DSL 2011 - Desarrollo jQueryWorkshop DSL 2011 - Desarrollo jQuery
Workshop DSL 2011 - Desarrollo jQuery
Rodrigo Ayala
 
Presentacion de Integración Continua
Presentacion de Integración ContinuaPresentacion de Integración Continua
Presentacion de Integración Continua
Rodrigo Ayala
 

More from Rodrigo Ayala (10)

Desarrollo en iOS devacademy
Desarrollo en iOS   devacademyDesarrollo en iOS   devacademy
Desarrollo en iOS devacademy
 
¿Por qué aprender a desarrollar aplicaciones móviles?
¿Por qué aprender a desarrollar aplicaciones móviles?¿Por qué aprender a desarrollar aplicaciones móviles?
¿Por qué aprender a desarrollar aplicaciones móviles?
 
How to be a Chef (Developer Edition)
How to be a Chef (Developer Edition)How to be a Chef (Developer Edition)
How to be a Chef (Developer Edition)
 
Optimización Web (+ HTML5)
Optimización Web (+ HTML5)Optimización Web (+ HTML5)
Optimización Web (+ HTML5)
 
Workshop "Técnicas de optimización web" en Webprendedor 2011
Workshop "Técnicas de optimización web" en Webprendedor 2011Workshop "Técnicas de optimización web" en Webprendedor 2011
Workshop "Técnicas de optimización web" en Webprendedor 2011
 
Workshop DSL 2011 - Desarrollo jQuery
Workshop DSL 2011 - Desarrollo jQueryWorkshop DSL 2011 - Desarrollo jQuery
Workshop DSL 2011 - Desarrollo jQuery
 
Bases de datos NoSQL
Bases de datos NoSQLBases de datos NoSQL
Bases de datos NoSQL
 
Presentacion Devise
Presentacion DevisePresentacion Devise
Presentacion Devise
 
Presentacion de Integración Continua
Presentacion de Integración ContinuaPresentacion de Integración Continua
Presentacion de Integración Continua
 
SELinux - Seguridad más allá de lo que imaginabas
SELinux - Seguridad más allá de lo que imaginabasSELinux - Seguridad más allá de lo que imaginabas
SELinux - Seguridad más allá de lo que imaginabas
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

The Backend Side of the Mobile