Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package HelloWord;
- use Web::Simple;
- use JSON::XS;
- use Digest::MD5 qw/md5_hex/;
- my $img = 'http://i.imgur.com/Ie2oDwW.jpg';
- sub dispatch_request {
- sub(POST + /mobile/login) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- api_key => md5_hex(rand),
- nome => "Teste Fake",
- email => 'nome_539-1@aoal.com',
- tipo => "PF",
- id => "288",
- sexo => "F"
- }
- )
- ]
- ];
- }, sub(POST + /mobile/logout) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- ok => 1
- }
- )
- ]
- ];
- }, sub(POST + /mobile/log) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- ok => 1
- }
- )
- ]
- ];
- }, sub(GET + /mobile/ofertas) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- linhas => [
- {
- imagem_icone => $img,
- imagem_pequena => $img,
- imagem_media => $img,
- imagem_grande => $img,
- url_compra => 'http://google.com/',
- preco_cheio => '10.00',
- preco_promocional => '9.80',
- nome => 'Ingresso Cinemark',
- descricoes => [
- {
- titulo => 'Info Tecnicas',
- conteudo => '220v bivolt 110 etc. etc..',
- },
- {
- titulo => 'Info Basiscas',
- conteudo => 'wwwo <b> pode ter html aqui <b>',
- },
- ]
- },
- {
- imagem_icone => $img,
- imagem_pequena => $img,
- imagem_media => $img,
- imagem_grande => $img,
- url_compra => 'http://ig.com.br/',
- preco_cheio => '15.00',
- preco_promocional => '15.80',
- nome => 'Titulo',
- descricoes => [
- {
- titulo => 'Nonono',
- conteudo => 'zooo',
- },
- {
- titulo => 'abc',
- conteudo => 'wwwo',
- },
- ]
- }
- ] # fim linhas
- },
- )
- ]
- ];
- }, sub(GET + /mobile/ajudometro) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- ajudometro => '101515.22',
- quantidade_piggmes => '4567.33',
- }
- )
- ]
- ];
- }, sub(POST + /mobile/esqueci_minha_senha) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- ok => '1'
- }
- )
- ]
- ];
- }, sub(GET + /mobile/entidades) {
- [
- 200,
- [ 'Content-type', 'application/json' ],
- [
- encode_json(
- {
- linhas => [
- {
- nome => 'Fundo Elas',
- id => '1223',
- imagem => $img
- },
- {
- nome => 'Projeto Arrastao',
- id => 1233,
- imagem => $img
- }
- ]
- }
- )
- ]
- ];
- }, sub() {
- [ 405, [ 'Content-type', 'text/plain' ], ['Method not allowed'] ];
- }
- }
- HelloWord->run_if_script;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement