The document discusses designing APIs with Ruby. It covers what an API is, different types of APIs, REST and CRUD conventions, implementing APIs with Ruby on Rails, versioning APIs, common response codes, and using the Rabl gem to generate API views. The presentation provides guidance on building APIs that are easy to implement, maintain and scale, with a focus on RESTful design principles and best practices for API development.
En esta platica trate de transmitir mejores practicas que se deben tener en cuenta cuando se diseña una API, y como ruby on rails te podria ayudar a desarrollarla en muy poco tiempo
Rapid mobile development with Ionic framework - Voxxdays Ticino 2015Alessio Delmonti
Meet Ionic, the best tool for faster go-to market strategy. Nowadays, developing mobile applications is about both technology and development time/cost. It's a hot topic for large companies and small startups who need to go to market quickly and cost-effectively. Ionic is the perfect tool for the rapid cross-platform development of high-quality mobile apps.
Ionic - Revolutionizing Hybrid Mobile Application DevelopmentJustin James
It has never been easier to build hybrid applications by using the Ionic Framework with technology that you already know and love such as AngularJS and Html 5. You will learn to love mobile development again.
En esta platica trate de transmitir mejores practicas que se deben tener en cuenta cuando se diseña una API, y como ruby on rails te podria ayudar a desarrollarla en muy poco tiempo
Rapid mobile development with Ionic framework - Voxxdays Ticino 2015Alessio Delmonti
Meet Ionic, the best tool for faster go-to market strategy. Nowadays, developing mobile applications is about both technology and development time/cost. It's a hot topic for large companies and small startups who need to go to market quickly and cost-effectively. Ionic is the perfect tool for the rapid cross-platform development of high-quality mobile apps.
Ionic - Revolutionizing Hybrid Mobile Application DevelopmentJustin James
It has never been easier to build hybrid applications by using the Ionic Framework with technology that you already know and love such as AngularJS and Html 5. You will learn to love mobile development again.
Rails Girls gives tools and a community for women to understand technology and to build their ideas. We do this by providing a great experiences on building things and make technology more approachable. We landed in South America with Buenos Aires as our first destination on the continent!
Assim como as Migrations no mundo Ruby On Rails, o mundo Java também possui diversas alternativas para evoluir o banco de dados de uma aplicação. Aprenda como você e sua equipe podem evoluir de maneira iterativa e incremental seu banco de dados (já em produção) durante a evolução da sua aplicação.
MongoDB es un motor de base de datos NoSQL que ha ganado mucha popularidad en los últimos tiempos, ya que ofrece muchos beneficios a la hora de desarrollar aplicaciones web.
En esta charla daremos una breve introducción a su instalación, configuración y funcionamiento. Luego repasaremos las distintas alternativas a la hora de usarlo en nuestras aplicaciones desarrolladas con PHP y Symfony2, y explicaremos cómo puede incrementar la velocidad de desarrollo y ayudar con aplicaciones web de alto rendimiento.
Easier with visual studio productivity toolsChris Eargle
Our Visual Studio Productivity Tools have always been about making your job easier, and this release is no exception. Tired of catering to Visual Studio’s multiple personalities between home and office? Take your settings to the cloud with JustCode! Having trouble sifting through tons of data to resolve a performance issue? JustTrace makes it easier with data visualizations and filters! Have a buggy assembly and no source code? Simply open the assembly and fix the problem directly inside JustDecompile!
Re-read that last sentence… fiddling around with a Visual Studio project is not required.
This is but a sample of how we’re making your life easier in Q2 2012. This presentation is not only free, but if time is money, it will pay you dividends.
Development of IMPROV: A Provisioning Solution at UNC-Chapel Hillceleste_copeland
When implementing a Provisioning solution for UNC-Chapel Hill, we found there was very little available in the Open Source ecosystem that addressed this Identity Management problem space. Thus we set about writing our own solution, in the hopes that we would then be able to contribute it back to the community.
We have nearly completed the first phase of the outcome, a system we call IMPROV (Identity Management Provisioning.) It consists of a SPML-based router mechanism that interacts with individual Services that provide our login identifiers, the Onyen and the UNC Guest ID. We intend future phases to include De-provisioning for these identifiers, and Provisioning/De-provisioning for other services such as Heelmail (our Microsoft Live@EDU implementation) and Exchange.
In this session, we plan to communicate the status of the project, discuss the architecture of IMPROV, and find others who would like to contribute to making this an Open Source project.
HTML5 Italy: Back end ecosystems for your applications - Cesare Rocchi + Clau...marcocasario
Talk tenuto da BaasBox durante il meeting di HTML5 Italy.
Scegliere su quale servizio di back end appoggiarsi per realizzare le nostre App non è così semplice come può sembrare a prima vista. Ce ne sono tanti, con differenti approcci, costi e vantaggi. Vedremo i pregi e i difetti dei maggiori player di mercato del segmento BaaS (Backend as a Service) per capire quale servizio e' il piu' adatto alle nostre esigenze di sviluppatori. Concluderemo con una demo live su come si costruisce un app con il software BaasBox
Estructuras de datos avanzadas: Casos de uso realesSoftware Guru
La utilización de estructuras de datos adecuadas para cada problema hace que se simplifiquen en gran medida los tiempos de respuestas y la cantidad de cómputo realizada.
Por Nelson González
Rails Girls gives tools and a community for women to understand technology and to build their ideas. We do this by providing a great experiences on building things and make technology more approachable. We landed in South America with Buenos Aires as our first destination on the continent!
Assim como as Migrations no mundo Ruby On Rails, o mundo Java também possui diversas alternativas para evoluir o banco de dados de uma aplicação. Aprenda como você e sua equipe podem evoluir de maneira iterativa e incremental seu banco de dados (já em produção) durante a evolução da sua aplicação.
MongoDB es un motor de base de datos NoSQL que ha ganado mucha popularidad en los últimos tiempos, ya que ofrece muchos beneficios a la hora de desarrollar aplicaciones web.
En esta charla daremos una breve introducción a su instalación, configuración y funcionamiento. Luego repasaremos las distintas alternativas a la hora de usarlo en nuestras aplicaciones desarrolladas con PHP y Symfony2, y explicaremos cómo puede incrementar la velocidad de desarrollo y ayudar con aplicaciones web de alto rendimiento.
Easier with visual studio productivity toolsChris Eargle
Our Visual Studio Productivity Tools have always been about making your job easier, and this release is no exception. Tired of catering to Visual Studio’s multiple personalities between home and office? Take your settings to the cloud with JustCode! Having trouble sifting through tons of data to resolve a performance issue? JustTrace makes it easier with data visualizations and filters! Have a buggy assembly and no source code? Simply open the assembly and fix the problem directly inside JustDecompile!
Re-read that last sentence… fiddling around with a Visual Studio project is not required.
This is but a sample of how we’re making your life easier in Q2 2012. This presentation is not only free, but if time is money, it will pay you dividends.
Development of IMPROV: A Provisioning Solution at UNC-Chapel Hillceleste_copeland
When implementing a Provisioning solution for UNC-Chapel Hill, we found there was very little available in the Open Source ecosystem that addressed this Identity Management problem space. Thus we set about writing our own solution, in the hopes that we would then be able to contribute it back to the community.
We have nearly completed the first phase of the outcome, a system we call IMPROV (Identity Management Provisioning.) It consists of a SPML-based router mechanism that interacts with individual Services that provide our login identifiers, the Onyen and the UNC Guest ID. We intend future phases to include De-provisioning for these identifiers, and Provisioning/De-provisioning for other services such as Heelmail (our Microsoft Live@EDU implementation) and Exchange.
In this session, we plan to communicate the status of the project, discuss the architecture of IMPROV, and find others who would like to contribute to making this an Open Source project.
HTML5 Italy: Back end ecosystems for your applications - Cesare Rocchi + Clau...marcocasario
Talk tenuto da BaasBox durante il meeting di HTML5 Italy.
Scegliere su quale servizio di back end appoggiarsi per realizzare le nostre App non è così semplice come può sembrare a prima vista. Ce ne sono tanti, con differenti approcci, costi e vantaggi. Vedremo i pregi e i difetti dei maggiori player di mercato del segmento BaaS (Backend as a Service) per capire quale servizio e' il piu' adatto alle nostre esigenze di sviluppatori. Concluderemo con una demo live su come si costruisce un app con il software BaasBox
Estructuras de datos avanzadas: Casos de uso realesSoftware Guru
La utilización de estructuras de datos adecuadas para cada problema hace que se simplifiquen en gran medida los tiempos de respuestas y la cantidad de cómputo realizada.
Por Nelson González
Onboarding new members into an engineering team is not easy on anyone. In a short period of time, the new team member is required to be able to bring professional
Por Victoriya Kalmanovich
El secreto para ser un desarrollador SeniorSoftware Guru
En esta charla platicaremos sobre el “secreto” y el camino para llegar a ser un desarrollador Senior, experiencia, consejos y recomendaciones que en estos 8 años
Por René Sandoval
Apache Airflow es una plataforma en la que podemos crear flujos de datos de manera programática, planificarlos y monitorear de manera centralizada.
Por Yesi Díaz
How thick data can improve big data analysis for business:Software Guru
En esta presentación hablaré sobre cómo el Análisis de Datos Gruesos, específicamente el análisis antropológico y semiótico, puede ayudar a mejorar los resultados del Big Data
Por Martin Cuitzeo
CoDi® es la nueva forma de realizar pagos digitales desarrollada por el Banco de México. Por medio de CoDi puedes realizar cobros y pagos desde tu celular, utilizando una cuenta bancaria o de alguna institución financiera, sin comisiones.
Por Cristian Jaramillo
Gestionando la felicidad de los equipos con Management 3.0Software Guru
En las metodologías agiles hablamos de equipos colaborativos, autogestionados y felices. hablamos de lideres serviciales. El management 3.0 nos ayuda a cultivar el mindset correcto, aquel que servirá como el terreno fértil para que la agilidad florezca.
Por Andrea Vélez Cárdenas
Taller: Creación de Componentes Web re-usables con StencilJSSoftware Guru
Hoy por hoy las experiences de usuario pueden ser enriquecidas mediante el uso de Web Components, que son un estándar de la W3C soportado por la mayoría de los navegadores web modernos.
Por Alex Arriaga
Así publicamos las apps de Spotify sin stressSoftware Guru
En Spotify tenemos 1600+ ingenieros, trabajando en 280+ squads. Aún a esta escala, hemos logrado adoptar prácticas que nos han permitido acelerar la forma en que desarrollamos nuestro producto. Presentado por Erick Camacho en SG Virtual Conference 2020
Achieving Your Goals: 5 Tips to successfully achieve your goalsSoftware Guru
he measure of the executive, Peter F. Drucker reminds us, is the ability to "get the right things done." This involves having clarity on what are the right things as well as avoiding what is unproductive. Intelligence, creativity, and knowledge may all be wasted if not put to work on the things that matter.
Presentado por Cristina Nistor en SG Virtual Conference 2020
Acciones de comunidades tech en tiempos del Covid19Software Guru
Acciones de Comunidades Tech en tiempo del COVID-19 es una platica para informar acerca de las acciones que están realizando algunas comunidades de tecnología en México para luchar contra la propagación del COVID-19. Desde análisis de datos, visualizaciones, simulaciones de contagio, etc.
Presentado por Juana Martínez, Adriana Vallejo y Eduardo Ramírez en SG Virtual Conference 2020
De lo operativo a lo estratégico: un modelo de management de diseñoSoftware Guru
La charla presenta un modelo claro, generado por la ponente, para atender los niveles desde lo operativo a lo estratégico.
Presentado por Gabriela Salinas en SG Virtual Conference
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
17. RECURSO
Cualquier cosa expuesta mediante web
Tienen una representación en datos
Con un servicio web intercambiamos
representaciones de recursos
Friday, June 15, 2012
26. ¿PORQUÉ UN API?
Aumenta la flexibilidad de un servicio
Friday, June 15, 2012
27. ¿PORQUÉ UN API?
Aumenta la flexibilidad de un servicio
Aumenta la utilidad de un servicio
Friday, June 15, 2012
28. ¿PORQUÉ UN API?
Aumenta la flexibilidad de un servicio
Aumenta la utilidad de un servicio
Libera los datos de usuario
Friday, June 15, 2012
29. ¿PORQUÉ UN API?
Aumenta la flexibilidad de un servicio
Aumenta la utilidad de un servicio
Libera los datos de usuario
Proporciona valor de negocio
Friday, June 15, 2012
46. VERSIONANDO TU API
• API Interna (entre aplicaciones)
• API Externa (aplicacion movil ? )
• API Usuarios (publico en general)
Friday, June 15, 2012
47. VERSIONANDO TU API
/int/api/products
/ext/api/products
/pub/api/products
Friday, June 15, 2012
48. VERSIONANDO TU API
/int/api/products?version=2
/ext/api/products?version=2
/pub/api/products?version=2
Friday, June 15, 2012
49. VERSIONANDO TU API
/v2/int/api/products
/v2/ext/api/products
/v2/pub/api/products
Friday, June 15, 2012
52. MUNDO IDEAL
Uso de: Accept Header
Accept: application/vnd.mycompany.com;version=2,application/json
Friday, June 15, 2012
53. CODIGOS HTTP
200 OK
201 Created
202 Accepted
400 Bad Request
401 Unauthorized
402 Payment Required
404 Not Found
409 Conflict
422 Unprocessable Entity
500 Internal Server Error
503 Service Unavailable
Friday, June 15, 2012
54. CODIGOS HTTP
HTTP/1.1 401 Unauthorized
{
“errors”: [
“api_key not found”
]
}
Friday, June 15, 2012
55. CODIGOS HTTP
HTTP/1.1 401 Unauthorized
{
“errors”: [
“api_key no valida”,
“api_key no puede contener
espacios”
]
}
Friday, June 15, 2012
56. CODIGOS HTTP
HTTP/1.1 401 Unauthorized
{
“errors”: [
“api_key no encontrada, por favor
visita http://account.myapp.com/api para
obtenerla”
]
}
Friday, June 15, 2012
57. CODIGOS HTTP
HTTP/1.1 400 Bad Request
{
“errors”: [
“Estructura JSON no valida”,
“unexpected TSTRING, expected ‘}’ at
line 2”
]
}
Friday, June 15, 2012
58. DOCUMENTACION
HTTP/1.1 422 Unprocessable Entity
{
“errors”: [
“vendor_code: no puede estar vacio”
],
“documentacion”: [
“vendor_code”: [
“descripcion” : “Codigo asignado por proveedor”,
“formato” : “Combinacion de tres letras seguidas de 4
numeros”,
“ejemplo” : “SOL1234”
]
]
}
Friday, June 15, 2012
59. CODIGOS HTTP
HTTP/1.1 503 Service Unavailable
{
“messages”: [
“En mantenimiento”
]
}
Friday, June 15, 2012
60. OPCIONES AVANZADAS
• Simuladores
• Autenticación
• Validadores
• Limite de uso
• Rapidez
• Balanceo
Friday, June 15, 2012
61. USANDO RUBY ON
RAILS PARA
IMLEMENTAR UNA API
Friday, June 15, 2012
62. APIS ON RAILS - REST
MyApp::Application.routes.draw do
resources :products
end
products GET /products(.:format) products#index
POST /products(.:format) products#create
new_product GET /products/new(.:format) products#new
edit_product GET /products/:id/edit(.:format) products#edit
product GET /products/:id(.:format) products#show
PUT /products/:id(.:format) products#update
DELETE /products/:id(.:format) products#destroy
Friday, June 15, 2012
63. APIS ON RAILS - REST
MyApp::Application.routes.draw do
scope ‘/api’ do
resources :products
end
end
products GET /api/products(.:format) products#index
POST /api/products(.:format) products#create
new_product GET /api/products/new(.:format) products#new
edit_product GET /api/products/:id/edit(.:format) products#edit
product GET /api/products/:id(.:format) products#show
PUT /api/products/:id(.:format) products#update
DELETE /api/products/:id(.:format) products#destroy
Friday, June 15, 2012
64. APIS ON RAILS -
gem 'versionist'
VERSIONES
MyApp::Application.routes.draw do
api_version(:module => 'V1', :path => 'v2') do
resources :products
end
end
v2_products GET /v2/products(.:format) V1/products#index
POST /v2/products(.:format) V1/products#create
new_v2_product GET /v2/products/new(.:format) V1/products#new
edit_v2_product GET /v2/products/:id/edit(.:format) V1/products#edit
v2_product GET /v2/products/:id(.:format) V1/products#show
PUT /v2/products/:id(.:format) V1/products#update
DELETE /v2/products/:id(.:format) V1/products#destroy
Friday, June 15, 2012
65. APIS ON RAILS,
CONTROLADOR
class V2::ProductsController < ApplicationController
respond_to :json
def index
@products = V2::Product.paginate(:page => (params[:page] || 1),
:per_page => (params[:per_page] || 100)).all
respond_with @products
end
def show
@product = V2::Product.find(params[:id])
respond_with @product
end
def update
@product = V2::Product.find(params[:id])
@product.update_attributes(params[:product])
respond_with @product
end
def destroy
@product = V2::Product.find(params[:id])
respond_with @product.destroy
end
end
Friday, June 15, 2012
66. APIS ON RAILS -
MODELO
class V2::Product < Product
JSON_ATTRIBUTES = {
properties: [
:id,
:upc,
:sku,
:list_cost,
:color,
:dimension,
:size,
:created_at,
:updated_at,
],
methods: [
:units_on_hand
]
}
end
Friday, June 15, 2012
67. APIS ON RAILS,
CONTROLADOR
gem ‘rabl’
class V3::ProductsController < ApplicationController
respond_to :json, :xml
def index
@products = V3::Product.paginate(:page => (params[:page] || 1),
:per_page => (params[:per_page] || 100)).all
end
def show
@product = V3::Product.find(params[:id])
end
def update
@product = V3::Product.find(params[:id])
@product.update_attributes(params[:product])
end
def destroy
@product = V3::Product.find(params[:id])
render json: {}, status: @product.destroy ? :ok : :unprocessable_entity
end
end
Friday, June 15, 2012
69. APIS ON RAILS
VISTAS
gem ‘jbuilder’
Jbuilder.encode do |json|
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at)
json.author do |json|
json.name @message.creator.name.familiar
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
end
if current_user.admin?
json.visitors calculate_visitors(@message)
end
json.comments @message.comments, :content, :created_at
end
Friday, June 15, 2012
70. APIS ON RAILS
VISTAS
gem ‘active_model_serializer’
class PostSerializer < ActiveModel::Serializer
attributes :id, :body
attribute :title, :key => :name
has_many :comments
def tags
tags.order :name
end
end
Friday, June 15, 2012
71. APIS ON RAILS
SEGURIDAD
Devise
Autenticacion Flexible para aplicaciones Rails
Compuesta de 12 modulos: database authenticable,
token authenticable, omniauthable, confirmable,
recoverable, registerable, trackable, timeoutable,
validatable, lockable
Friday, June 15, 2012
72. APIS ON RAILS
SEGURIDAD
Devise
Autenticacion Flexible para aplicaciones Rails
Compuesta de 12 modulos: database authenticable,
token authenticable, omniauthable, confirmable,
recoverable, registerable, trackable, timeoutable,
validatable, lockable
Friday, June 15, 2012
73. APIS ON RAILS
SEGURIDAD
gem ‘rabl’
class V3::ProductsController < ApplicationController
before_filter :authenticate_user!
respond_to :json, :xml
def index
@products = V3::Product.paginate(:page => (params[:page] || 1),
:per_page => (params[:per_page] || 100)).all
end
def show
@product = V3::Product.find(params[:id])
end
def update
@product = V3::Product.find(params[:id])
@product.update_attributes(params[:product])
end
def destroy
@product = V3::Product.find(params[:id])
render json: {}, status: @product.destroy ? :ok : :unprocessable_entity
end
end
Friday, June 15, 2012
74. APIS ON RAILS
PRUEBAS
describe V3::ProductsController do
before do
@request.env["HTTP_ACCEPT"] = "application/json"
end
describe "#index" do
context "cuando no se pasa ningun atributo" do
it "regresa los registros en paginas" do
get :index
response.should be_success
data = JSON.parse(response.body)
Product.count.should > 0
data['products'].length.should == Product.count
end
end
end
end
Friday, June 15, 2012
75. APIS ON RAILS
PRUEBAS
describe V3::ProductsController do
before do
@request.env["HTTP_ACCEPT"] = "application/json"
end
describe "#show" do
context "pasando un id inexistente" do
it "responde con http 404 y un mensaje de error" do
get :show, id: -1
response.code.should == "404"
JSON.parse(response.body)['error'].should == "ActiveRecord::RecordNotFound"
JSON.parse(response.body)['message'].should == "Couldn't find Product with
id=-1"
end
end
end
end
Friday, June 15, 2012
76. APIS ON RAILS
PRUEBAS
describe V3::ProductsController do
before do
@request.env["HTTP_ACCEPT"] = "application/json"
end
describe "#create" do
context "con malos atributos" do
it "responde con un error" do
post :create, product: {bad_key: "foo"}
response.code.should == "400"
json_response = JSON.parse(response.body)
json_response['error'].should == "ActiveRecord::UnknownAttributeError"
json_response['message'].should == "unknown attribute: bad_key"
end
end
end
end
Friday, June 15, 2012
77. APIS ON RAILS
PRUEBAS
describe V3::ProductsController do
before do
@request.env["HTTP_ACCEPT"] = "application/json"
end
describe "#create" do
context "con atributos correctos" do
it "responde correctamente y crea el producto" do
expect {
post :create, product: {name: "productito"}
}.to change(Product, :count).by(1)
end
end
end
end
Friday, June 15, 2012
84. use ActionDispatch::Static
use Rack::Lock
use
#<ActiveSupport::Cache::Strategy::Loc
alCache::Middleware:0x007fd3b32928c0>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActionDispatch::Cookies
use
ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use ActionDispatch::Head
use Rack::ConditionalGet
use Rack::ETag
use
ActionDispatch::BestStandardsSupport
use
Rack::Mongoid::Middleware::IdentityMa
p
Friday, June 15, 2012
85. use ActionDispatch::Static
use Rack::Lock
use
#<ActiveSupport::Cache::Strategy::Loc use ActionDispatch::Static
alCache::Middleware:0x007fd3b32928c0> use Rack::Lock
use Rack::Runtime use
use Rack::MethodOverride #<ActiveSupport::Cache::Strategy::LocalCac
use ActionDispatch::RequestId he::Middleware:0x007fe74448cf50>
use Rails::Rack::Logger use Rack::Runtime
use ActionDispatch::ShowExceptions use ActionDispatch::RequestId
use ActionDispatch::DebugExceptions use Rails::Rack::Logger
use ActionDispatch::RemoteIp use ActionDispatch::ShowExceptions
use ActionDispatch::Reloader use ActionDispatch::DebugExceptions
use ActionDispatch::Callbacks use ActionDispatch::RemoteIp
use ActionDispatch::Cookies use ActionDispatch::Reloader
use use ActionDispatch::Callbacks
ActionDispatch::Session::CookieStore use
use ActionDispatch::Flash ActiveRecord::ConnectionAdapters::Connecti
use ActionDispatch::ParamsParser onManagement
use ActionDispatch::Head use ActiveRecord::QueryCache
use Rack::ConditionalGet use ActionDispatch::ParamsParser
use Rack::ETag use ActionDispatch::Head
use use Rack::ConditionalGet
ActionDispatch::BestStandardsSupport use Rack::ETag
use
Rack::Mongoid::Middleware::IdentityMa
p
Friday, June 15, 2012