Skip to content

juliojgarciaperez/jpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to jPool!

jPool is a rails 5 api-only app with a sqlite3 database and rspec as testing framework. In order to accomplish the exercise you need to complete a CRUD over the Person Model:

  • Create new person via POST /people
  • Get list of people via GET /people

Tasks:

1. Create an ActiveRecord Person model with the following mandatory attributes :

  • name
  • age: must be greater than 18
  • email: must be valid email format
  • code Integer

Add the necessary ActiveModel validations


2. Develop the necessary controller action to create a new person record via POST /people The application should receive a token parameter in order to create a new person. token will be used to obtain person data from the following web service:

GET http://www.mocky.io/v2/<token>

Use the following token as an example: 5b1e4132310000ea143ff716

{
    "name": "Mrs. Joana Casper",
    "email": "joana.casper@11paths.com",
    "age": 32,
    "fibonacci": 15
}

Person's name, age and email will be directly obtained from the web service.

code will be the Fibonacci number in fibonacci position

In order to keep our controllers DRY and KISS, we'll create the app/services/person_service.rb class to create instances that receive a token and return a new Person object using #build_person method.

Note*: This code would be deployed to production. It's a must to develop some tests for the PersonService class. The app is using rspec with the basic structure ready-to-code.


3. Last but not least, develop the necessary controller action so that GET /people returns a JSON array with people data. It will accept an optional code_min parameter to apply some filters.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages