j-sm-n / black_thursday

Black Thursday is a system that is able to load, parse, search, and execute business intelligence queries against the data from a typical e-commerece business in Ruby.
0 stars 0 forks source link

Data Access Layer - CustomerRepository #46

Closed jesse-spevack closed 8 years ago

jesse-spevack commented 8 years ago

CustomerRepository

Customers represent a person who's made one or more purchases in our system.

The CustomerRepository is responsible for holding and searching our Customers instances. It offers the following methods:

all - returns an array of all known Customers instances find_by_id - returns either nil or an instance of Customer with a matching ID find_all_by_first_name - returns either [] or one or more matches which have a first name matching the substring fragment supplied find_all_by_last_name - returns either [] or one or more matches which have a last name matching the substring fragment supplied The data can be found in data/customers.csv so the instance is created and used like this:

cr = CustomerRepository.new cr.from_csv("./data/customers.csv") customer = cr.find_by_id(6)

=>

https://github.com/turingschool/curriculum/blob/master/source/projects/black_thursday/iteration_3.markdown#customerrepository