Coder Social home page Coder Social logo

prism-demo's Introduction

PRISM - companies database

Configuration

To set configuration file you can reuse template file which is available in config/database.yml.template. PRISM will look for config file by default in config/database.yml if you want to change that you can specify ENV["CONFIG_FILE"] to something else.

Copy config/database.yml.template to config/database.yml

 cp config/database.yml.template to config/database.yml

How to run tests

ruby tests/prism_test.rb

How to use API

To interact with the application you will need cUrl application.

If you want to see also http headers use -i with curl like:

curl -i ....

Fetch all companies

curl http://prism-demo.herokuapp.com/companies

Create new company

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name": "NASA", "address": "Wojska Polskiego", "city": "Szczecin", "country": "Poland" }' http://prism-demo.herokuapp.com/company

curl -i -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"name": "NASA", "address": "Wojska Polskiego", "city": "kazi", "country": "USA", "owners":[{"full_name":"Robert"}, {"full_name":"Adam"}], "phone_number": "1241241241" }' http://prism-demo.herokuapp.com/company

Fetch company by ID=1

curl http://prism-demo.herokuapp.com/company/1

Update company with ID=1

curl -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"name": "New name", "address": "Wojska Polskiego", "city": "kazi", "country": "Niemcy"}' http://prism-demo.herokuapp.com/company/1

curl -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"name": "NASA", "address": "Wojska Polskiego", "city": "kazi", "country": "USA", "owners":[{"full_name":"Robert"}, {"full_name":"Adam"}], "phone_number": "1241241241" }' http://prism-demo.herokuapp.com/company/1

Upload pdf for the owner (with ID=3) of the company (with ID=1)

curl -i -H "Accept: application/json" -X PUT -F "[email protected]" http://prism-demo.herokuapp.com/company/1/3/upload

Fetch owner pdf from company ID=1 and owner ID=1

curl -i http://prism-demo.herokuapp.com/company/1/owner/1 -o 1.pdf

prism-demo's People

Contributors

mitfik avatar

Stargazers

W.S avatar Anthony 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.