Git Product home page Git Product logo

state-machine's Introduction

State Machine

Build StatusCoverage Status

The propose of this project is provide an API to manage transactions between two endpoints. The operations between endpoints isn't provided, being necessary a mediator for this.

Running this project

To run this project just run commands below:

$ docker-compose up -d
$ docker-compose exec php vendor/bin/phinx migrate -e development

Initiating transactions

By default, this project will run in http://localhost:8080. You can create a new transaction through the endpoint /v1/transaction/, as the following example:

POST /v1/transaction

{
  "type": "operation_irrigate_plant",
  "status": "trying_to_get_water"
}

HTTP/1.1 201 Created

{
  "transaction_id": "f2dd028410f011e793ae92361f002671",
  "type": "operation_irrigate_plant",
  "status": "trying_to_get_water",
  "created": "2017-03-30 14:12:02",
  "updated": null
}

Getting transactions

Getting a existing transaction:

GET /v1/transaction/f2dd0284-10f0-11e7-93ae-92361f002671

HTTP/1.1 200 Ok

{
  "transaction_id": "f2dd028410f011e793ae92361f002671",
  "type": "operation_irrigate_plant",
  "status": "trying_to_get_water",
  "created": "2017-03-30 14:12:02",
  "updated": null
}

Updating transactions

You can update transaction sending a PUT request, as the following example:

PUT /v1/transaction/f2dd0284-10f0-11e7-93ae-92361f002671

{
  "status": "trying_to_water_the_plant"
}


HTTP/1.1 200 Ok

{
  "transaction_id": "f2dd028410f011e793ae92361f002671",
  "type": "operation_irrigate_plant",
  "status": "trying_to_get_water",
  "created": "2017-03-30 14:12:02",
  "created": "2017-03-30 14:17:24"
}

state-machine's People

Contributors

ricardotulio avatar

Stargazers

Vitor Abner 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.