Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 2.02 KB

README.md

File metadata and controls

78 lines (56 loc) · 2.02 KB

Rails Programming Task

In order to be considered for a rails position, you must complete the following steps.

Note: This task should take no longer than 1-2 hours at the most to complete.

Prerequisites

Task

  • Fork this repository
  • Create directory challenge
  • In the challenge directory, scaffold a simple Rails 5 or above web app that models a credit card charge. JSON data structure below:
  {
    "id",
    "created",
    "paid",
    "amount",
    "currency",
    "refunded",
    "customer_id"
  }
*Note: Amount is in USD, cents*
  • Also scaffold a customer object which only has a first and last name.

The charge object has a customer property, this property is the customer id from the customer model.

Seed 4 Customers into the system
Seed 15 charges (charges) into the system
10 Should be paid charges:
  - 5 Should be linked to Customer 1
  - 3 Should be linked to Customer 2
  - 1 Should be linked to Customer 3
  - 1 Should be linked to Customer 4

5 Should be charges that refunded:
  - 3 Should be linked to Customer 3
  - 2 Should be linked to Customer 4
Create a json of Different charges

On the controller that shows all charges (most likely the GET /charges route), return a json list as follows.

"data": { "paid": [ { "id": 111, "customer_name": 'customer 1' } ], "refunded": [ { "id": 111, "customer_name": 'customer 2' } ] }

Tests - OPTIONAL

Create the following RSpec tests:

  1. Verify that in the Paid charges list there are 10 line items. Verify that in the refunded charges list there are 5 failed charges.

Once Complete

  1. Commit and Push your code to your new repository
  2. Send us a pull request, we will review your code and get back to you