WAPI - Web API Server Spec
por Roger Leite - 2012
Table of Contents
- Web API Server Spec
- Interfaces
- Styles
| source "https://rubygems.org" | |
| gem "faker", "~> 1.1.2" | |
| gem "uuid", "~> 2.3.7" |
| require "avc" | |
| require "fileutils" | |
| Donkey = HttpMonkey.build do | |
| storage AVC::HttpClient::FileStore.new(File.expand_path("~/.avc/donkey")) | |
| middlewares.use AVC::HttpClient::M::CacheByEtag | |
| end | |
| puts "# Smeagol Assistant\n" |
| source 'https://rubygems.org' | |
| gem "method_source", "~> 0.8.1" |
WAPI - Web API Server Spec
por Roger Leite - 2012
Table of Contents
| #!/usr/bin/env ruby | |
| # Ruby Query Language *snaky edition* | |
| # usage: ./rql sample.rql | |
| module RQL | |
| class Context | |
| def self.evaluate(rql_script) |
| user www-data; | |
| worker_processes 4; | |
| error_log logs/error.log; | |
| #error_log logs/error.log notice; | |
| #error_log logs/error.log info; | |
| pid logs/nginx.pid; | |
| events { |
The [architectural simplicity from Web][webarch] plus the use of a widely implemented protocol (HTTP), it's a great platform for an ecosystem of services.
REpresentational State Transfer, describe Web as distributed hypermedia application whose linked resources communicate by exchanging representations of resource state. (from [Chapter 1 - Rest in Practice Book][Rest in Practice])
| [user] | |
| name = Roger Leite | |
| email = [email protected] | |
| [core] | |
| editor = mvim | |
| excludesfile = /Users/Roger/.gitignore | |
| [color] | |
| diff = auto | |
| interactive = auto | |
| status = auto |
| # Restfolia - Restfulie | |
| - Resource Read Write; | |
| - Resource com interface Hash; | |
| - Links com metodos; | |
| - Alias get -> get!; | |
| - Some Alias | |
| ## Resource Read Write | |
| Ex: |
| ################################################################################################################ | |
| # Criando uma imagem | |
| ################################################################################################################ | |
| imagens_entry_point = Restfulie.at(IMAGENS_ENTRY_POINT).get | |
| nova_imagem = imagens_entry_point.links.nova_imagem.get | |
| nova_imagem.imagem.original = "cid:original" #Identificador da imagem na parte não json da requisição, veja a especificação de multpart para mais detalhes (http://www.faqs.org/rfcs/rfc2387.html) | |
| nova_imagem.imagem.marca = "Alexandria" | |
| nova_imagem.imagem.titulo = "alexandria logo" |