This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"first_name":["can't be blank"], | |
"last_name":["can't be blank"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact < ActiveRecord::Base | |
validates :full_name, presence: true | |
validates :alias, presence: true | |
validates :importance_level, inclusion: { | |
in: [100, 200, 300] | |
} | |
validates :age, numericality: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Verb | URI Pattern | | |
| -------| ------------------------------------------- | | |
| GET | http://example.com/api/v1/contacts.json | | |
| POST | http://example.com/api/v1/contacts.json | | |
| GET | http://example.com/api/v1/contacts/:id.json | | |
| PATCH | http://example.com/api/v1/contacts/:id.json | | |
| DELETE | http://example.com/api/v1/contacts/:id.json | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id":1, | |
"age":32, | |
"importance_level":100, | |
"alias":"hippipp", | |
"full_name":"S-H, Erin", | |
"url":"http://example.com/api/v1/contacts/1.json" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server | |
var express = require('express') | |
, fs = require('fs') | |
, http = require('http') | |
, path = require('path') | |
, barrister = require('barrister') | |
, store = require("./store").store | |
, idl = JSON.parse(fs.readFileSync("./todo_manager.json").toString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Barrister Client Initialization | |
function initApp(callback) { | |
var client = Barrister.httpClient({ | |
'endpoint': '/todos', | |
'interfaces': ['TodoManager'] | |
}); | |
client.loadContract(function() { | |
var proxy = client.proxy('TodoManager'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[dev]$ pip install barrister | |
Downloading/unpacking barrister | |
Downloading barrister-0.1.6.tar.gz | |
Running setup.py (path:/private/var/folders/lb/v0d4zb6j6z39m7vfzc4vb47h0000gn/T/pip_build_erinswenson-healey/barrister/setup.py) egg_info for package barrister | |
Downloading/unpacking Markdown (from barrister) | |
Downloading Markdown-2.4.tar.gz (260kB): 260kB downloaded | |
Running setup.py (path:/private/var/folders/lb/v0d4zb6j6z39m7vfzc4vb47h0000gn/T/pip_build_erinswenson-healey/Markdown/setup.py) egg_info for package Markdown | |
Downloading/unpacking plex (from barrister) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[dev]$ pip install barrister | |
Downloading/unpacking barrister | |
Downloading barrister-0.1.6.tar.gz | |
Running setup.py (path:/private/var/folders/lb/v0d4zb6j6z39m7vfzc4vb47h0000gn/T/pip_build_erinswenson-healey/barrister/setup.py) egg_info for package barrister | |
Downloading/unpacking Markdown (from barrister) | |
Downloading Markdown-2.4.tar.gz (260kB): 260kB downloaded | |
Running setup.py (path:/private/var/folders/lb/v0d4zb6j6z39m7vfzc4vb47h0000gn/T/pip_build_erinswenson-healey/Markdown/setup.py) egg_info for package Markdown | |
Downloading/unpacking plex (from barrister) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import barrister | |
import sys | |
from bottle import run, post, request | |
from store import Store, RecordNotFound, UserDataInvalid, MaxTodosExceeded | |
from functools import wraps | |
def guard(*exceptions): | |
errors = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import barrister | |
from bottle import run, post, request | |
from store import Store, RecordNotFound, UserDataInvalid, MaxTodosExceeded | |
from functools import wraps | |
import sys | |
import code | |
class TodoManager(object): |