delynn / rails_engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails Engine

The Rails Engine project takes in CSV data from the Black Thursday repo and creates a RESTful Rails API that includes record endpoints, relationship endpoints, and business intelligence endpoints.

Getting Started

Clone down the repo:

  $ git clone https://github.com/julsfelic/rails_engine.git

Then change into the project directory:

  $ cd rails_engine

Installing

Let's go ahead and get the database setup:

  $ rake db:setup

Then import the CSV data:

  $ rake import:all

There is also the option to import only specific subsets of the CSV data:

$ rake import:customers
$ rake import:invoice_items
$ rake import:invoices
$ rake import:items
$ rake import:merchants
$ rake import:transactions

Once the rake task is complete, go ahead and run the test suite to confirm that setup was completed successfully:

  $ rspec

To hit our API endpoints let us start up a server:

  $ rails s

And using a tool like Postman or cURL we can tell our API to return JSON data. Here is an example endpoint using cURL:

  curl -XGET localhost:3000/api/v1/merchants/find_all?name=Cummings-Thiel

This will return a collection of transactions associated with the specific customer. For a full list of all the endpoints reference the official Rails Engine docs

Running the tests

Rails Engine uses RSpec for its test suite. To run the tests:

  $ rspec

Authors

  • Julian Feliciano - Initial work - julsfelic

About


Languages

Language:Ruby 93.6%Language:HTML 5.0%Language:CSS 0.7%Language:JavaScript 0.7%