Giter Site home page Giter Site logo

ooorest's Introduction

Build Status

Basic REST Usage

Require the gem in your Gemfile with:

gem 'ooorest', git: 'https://github.com/akretion/ooorest.git'

then run

bundle install

Finally mount in your Rails application as an engine, for instance by adding this line in your config/routes.rb

mount Ooorest::Engine => "/ooorest"

You can now talk to OpenERP using REST webservices in JSON or XML formats!

You may run

rake routes

to discover the basic REST routes.

For instance you can get the list of OpenERP users with:

GET /ooorest/res-users.json

You can also read user with 1 with:

GET /ooorest/res-users/1.json

the OpenERP model name param should come after the engine scope ('ooorest' here). Note that '.' from OpenERP model names are replaced by '-' (res.users -> res-users).

Usage as a Rails framework

You may also just require ooorest but not necessarily mount the engine. You may simply enjoy using the RequestHelper class that makes it easy to write your own custom Rails controllers to deal with OpenERP objects seamlessly.

You can choose to bootstrap a default public OOOR connection in your Rails app by setting an appropriate config/ooor.yml config file (see in test/dummy/config/ooor.yml for an example). In this case the mentionned classes will be bootstraped and you'll be able to use them in your Rails application. These classes will use the credentials defined in ooor.yml. Warning! this can be a security issue! So make sure that the public credentials you use here only have basic acess rights, possibly no write permissions at all in your OpenERP (specially if you mount the engine and hence enable default CRUD actions).

If you want to enable users to write in your OpenERP, you should instead use an authentication system such as Devise and then use the ooor_object method from RequestHelper, for instance:

ooor_object('product.product')

wich will appropriately instanciate OpenERP proxies with appropriate specific OpenERP credentials according to the Rails logged user. TODO to be explained better.

ooorest's People

Contributors

rvalyi avatar

Watchers

 avatar  avatar

Forkers

rogeriofalcone

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.