Giter Site home page Giter Site logo

rubyjsonrestsinatraherokutdd's Introduction

RubyJsonRestSinatraHerokuTdd

A small test of ruby power:

--> Web service:

--> REST / JSON, Ruby, Sinatra, API:

 --> Create new company

 --> Get a list of all companies

 --> Get details about a company

 --> Update a company

 --> Attach pdf-versions ...

--> Company attributes:

 --> Company ID

 --> Name

 --> Address

 --> City

 --> Country

 --> E-mail (not required)

 --> Phone Number (not required)

 --> One or more directors and beneficial owners.

--> Prepare:

    bundle

    rake migrate

--> Run/Start:

    rackup

--> Usage:

    Add/Create new company:

Command: curl -X POST -d '{"name": "AN", "address": "AA", "city": "AC", "country": "ACr"}' http://localhost:9292/api/companies

    Output: {"id":1,"name":"AN","address":"AA","city":"AC","country":"ACr","email":null,"phone_number":null,"created_at":"2013-11-26T19:14:35+00:00","updated_at":"2013-11-26T20:14:35+01:00"}

    Display all companies:

Command: curl -X GET http://localhost:9292/api/companies

Output: [{"id":1,"name":"AN","address":"AA","city":"AC","country":"ACr","email":null,"phone_number":null,"created_at":"2013-11-26T19:14:35+00:00","updated_at":"2013-11-26T20:14:35+01:00"}]

Display the company by id:

Command: curl -X GET http://localhost:9292/api/company/1

Output: {"id":1,"name":"AN","address":"AA","city":"AC","country":"ACr","email":null,"phone_number":null,"created_at":"2013-11-26T19:14:35+00:00","updated_at":"2013-11-26T20:14:35+01:00"}

Delete the company by id:

    Command: curl -X DELETE http://localhost:9292/api/company/1

Update the company by id:

Command: curl -X PUT -d '{"email": "AEm", "phone_number": "APn"}' http://localhost:9292/api/company/1

Output: {"id":1,"name":null,"address":null,"city":null,"country":null,"email":"AEm","phone_number":"APn","created_at":"2013-11-26T19:14:35+00:00","updated_at":"2013-11-26T20:26:27+01:00"}

Add/Create new company, without required:

Command: curl -X POST -d '{"address": "CA", "city": "CC", "country": "CCr"}' http://localhost:9292/api/companies

Output: Without output, when required lack

--> Tests:

bundle exec ruby tests/main_tests.ru

  or

    bash RunCurlTests

Toolchain:

Ruby (Sinatra)

Ember, Bootstrap, jQuery

Less

PostgreSQL/MySQL/MongoDB

DONE:

Data versioning

AngularJs

TODO:

Mongodb not sqlite3

file attachment

Heroku deployment

rubyjsonrestsinatraherokutdd's People

Contributors

golebier avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.