This is an assignment I was offered by a company who I didn't end up applying for. I decided to complete it anyways
Here's the full text from the spec I was given:
Implementing an API for Book Management System
- Each user has an initial account number and includes a certain amount
- The user can borrow books from the library (deduct a certain fee after each loan return), and cannot borrow books when there is no balance.
- Query the account of a user and the details of the current borrowed book, The parameter is the user.
- Query the current remaining number of each book, the total number of loans, and the current loan status between the users.
API interface that needs to be implemented:
- Create a user interface, the requested parameters support setting the initial amount, returning the user ID
- Create a borrowing transaction with parameters for the user's ID and the book's ID
- Create a return transaction with parameters for the user's ID and the book's ID
- Query the account status of a user, the parameter is the user ID, return the current balance, and borrow books.
- Query the actual income of a book, the parameter is the ID and time range of the book, and return the transaction amount obtained by the book during this time.
- You can choose any Ruby framework to complete this API
- Please provide API documentation to let us know how to request your service.
- Record the design ideas in README.md
- To save time, the user module can be considered using a mature Gem implementation. 5. If time permits, it is best to deploy a demo address that can be called directly
- At any time, the user's balance must be greater than or equal to 0.
- Regarding the book income function, if there is no time, you can not do it.
Try to implement all the functions, we will evaluate according to the following points:
- How many features are completed and the quality of the completion
- The design, code quality, etc. of the entire application
- Overall/partial solutions and design ideas
- Test code coverage and quality
After this test is complete, you can push the code onto GitHub and the email tells us the corresponding Repo address and the URL that can be called (if any).