cesarbruschetta / load-system

Loan Management System
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Documentation of REST API (Leonardo) #12

Open julianeventeu opened 5 years ago

julianeventeu commented 5 years ago

Development of Loan API documentation based on RAML pattern.

The RAML specification is available in https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/

The documentation should contain the endpoints to create a LOAN, a PAYMENT and obtain de BALANCE. It to need to describe responses affirmatives and negatives in each endpoint.

Leonardoperrella commented 5 years ago

%RAML 1.0

title: Loan Management System API version: 1.0

documentation:

/loans: post: description: |

  amount: loan amount in dollars.
  term: number of months that will take until the loan gets paid-off.
  rate: interest rate as decimal.
  date: when the loan was requested (origination date as an ISO 8601 string).
  loan_id: unique id of the loan.
  installment: monthly loan paymen

body:
  application/json: 
    example: |
responses: 
  200:
    body: 
      application/json:
        example: |
          Example of sent data
          {"amount": 1000,"term": 12,"rate": 0.05,"date": "2019-05-09 03:18Z"}

          Example of received data
          {"loan_id": "000-0000-0000-0000""installment": 85.60}

          Loan payment formula
          "r = rate / 12"
          "installment = [r + r / ((1 + r) ^ term - 1)] x amount"  

/loans/<:id>/payments: post: description: | payment: type of payment: made or missed. date: payment date. amount: amount of the payment made or missed in dollars. The <:id> is going to be controled by token. body: application/json: example: | responses: 200: body: application/json: example: | Example of sent data (Payment made) {"payment": "made","date": "2019-05-07 04:18Z","amount": 85.60}

          Example of sent data (Payment missed)
          {"payment": "missed","date": "2019-05-07 04:18Z","amount": 85.60}

/loans/<:id>/balance:
get: description: | date: loan balance until this date. balance: outstanding debt of loan. Period filter: end_date is optional, the default is considered today. The <:id> is going to be controled by token responses: 200: body: application/json: example: | Payload Example of sent data {"date": "2017-09-05 02:18Z"}

          Reply
          Example
          {"balance": 40}
cesarbruschetta commented 5 years ago

@Leonardoperrella I think you better create a branch and upload your code in a branch in the repository and open a PR, because here in the comments, you ended up losing the code formation...

Leonardoperrella commented 5 years ago

Do You have a tutorial, because I dobro kwow How to do. Thaks

rafaelmpessoa commented 5 years ago

yes, install git, https://git-scm.com/book/pt-br/v2/Come%C3%A7ando-Instalando-o-Git

then execute these commands:

clone the project git clone https://github.com/cesarbruschetta/load-system.git create a new branch git checkout -b leonardo_loan_system create a new file .raml with your doc.

git add * git commit -m "leonardo loan system doc" git push origin *YOUR_BRANCH_NAME* ex: git push origin leonardo_loan_system

after that in the github console, open your branch and click in a green button "compare e marge" automatically will createa new pull request with yout changes.

dariodinizg commented 5 years ago

Probably, git will warn you that your your local repository is not linked with a remote(online) one. At this point, he will show you a command line you can use to link both.

Leonardoperrella commented 5 years ago

I did something wrong. The file I posted wasn't the right one. So now I don't how to delete and do it again. Could, someone help me for this issue?

dariodinizg commented 5 years ago

I sent you a message via RocketChat.