Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f5f0d74
initial Rails setup
dnguye2 May 26, 2020
6cb08b6
adds Customers controller
theomoondev May 26, 2020
d07f8c1
adds Customer model
theomoondev May 26, 2020
272bd83
added Video model
dnguye2 May 26, 2020
ad727cb
adds Rental model
theomoondev May 26, 2020
dd45d66
generates migration relating customer and video to rentals
theomoondev May 26, 2020
b6495e8
added migration for videos_checked_out_count for cust
dnguye2 May 26, 2020
3c264d0
Merge branch 'master' of https://github.com/peachmakkoli/video-store-api
dnguye2 May 26, 2020
09c9135
generates migration adds available_inventory to videos
theomoondev May 26, 2020
400c09e
removes duplicate column from customers and videos, migrates database
theomoondev May 26, 2020
fa07780
created Videos controller
dnguye2 May 27, 2020
bf7a34d
videos index tests complete
dnguye2 May 27, 2020
20caa72
video index controller action complete
dnguye2 May 27, 2020
1b6c77e
added test for a status 200 for index when empty array
dnguye2 May 27, 2020
152d29d
adds first test for customers#index action
theomoondev May 27, 2020
8148bb5
adds tests checking that customers#index returns proper fields
theomoondev May 27, 2020
cbe4463
defines customers#index action, gets a list of customers
theomoondev May 27, 2020
91ffddd
revises test for if no customers exists, checks for 200 status
theomoondev May 27, 2020
30c1bf8
added 3 records for videos fixtures
dnguye2 May 27, 2020
6452d60
Merge pull request #2 from peachmakkoli/01-lh-get-customers
theomoondev May 27, 2020
352608e
Merge pull request #1 from peachmakkoli/01-dn-get-videos
dnguye2 May 27, 2020
bbb0179
generates migration to change release_date and due_date datatypes to …
dnguye2 May 27, 2020
88cd2b4
updates the change date datatype migration by implementing 'using cas…
dnguye2 May 27, 2020
22ab770
generates migration for adding address, city, state to customers
theomoondev May 27, 2020
59be309
adds test for videos#show action
theomoondev May 27, 2020
c3ff2d4
adds videos#show action, renders error message when id is invalid
theomoondev May 27, 2020
3e7daf4
changes VIDEO_FIELDS constant to VIDEO_INDEX_FIELDS, adds VIDEO_SHOW_…
theomoondev May 27, 2020
b41fcff
completes videos#show action, renders details about specific video
theomoondev May 27, 2020
7ca030e
updates schema.rb to reflect latest migrations AddColumnsToCustomers …
theomoondev May 27, 2020
b5b3a44
added validations for video model
dnguye2 May 27, 2020
848e6a4
added validations to video model
dnguye2 May 27, 2020
21b36f2
added videos#create action
dnguye2 May 27, 2020
e8f6bb9
added `check_response` helper method and video#create tests which all…
dnguye2 May 27, 2020
7824107
dries up videos #index and #show tests using check_response method
theomoondev May 28, 2020
e0d15d1
Merge pull request #4 from peachmakkoli/02-dn-post-video
dnguye2 May 28, 2020
e0a45be
Merge branch 'master' into 02-lh-get-video-id
theomoondev May 28, 2020
728f5e7
Merge pull request #3 from peachmakkoli/02-lh-get-video-id
theomoondev May 28, 2020
e361da2
adds validations and relationships to models
theomoondev May 28, 2020
2f08270
fixes syntax error with missing end after show action
theomoondev May 28, 2020
d7ccd1b
fixes response errors for videos#show action and test to pass smoke test
theomoondev May 28, 2020
03a9cf8
removes require :video from video_params to pass smoke tests
theomoondev May 28, 2020
93aa815
adds validations for :total_inventory and :available_inventory, must …
theomoondev May 28, 2020
fe03d0c
generates migration for videos, changes available_inventory default t…
theomoondev May 28, 2020
a1ccb85
adds total_inventory to video_params, all smoke tests for wave 1 passing
theomoondev May 28, 2020
12678b7
fixes videos#create tests
theomoondev May 28, 2020
87c4d78
adds tests for customer videos_checked_out_count validations
theomoondev May 28, 2020
c8ed746
added tests for video model validations
dnguye2 May 28, 2020
7b61db1
adds tests for rental validations
theomoondev May 29, 2020
d63a157
adds dependent:nullify to rental relationship in customer and video m…
theomoondev May 29, 2020
c785f66
creates rentals/check-in route, adds pseudocode and test cases for re…
theomoondev May 29, 2020
b001958
renders json for rentals#check-in action, tests whether the proper fi…
theomoondev May 29, 2020
b2c9264
tests whether rentals#check-in decrements videos_checked_out_count, i…
theomoondev May 29, 2020
7aab4da
tests whether rentals#check-in returns detailed errors and a 404 if c…
theomoondev May 29, 2020
18e0e04
added fixture for edge case when a checkout is requested with 0 avail…
dnguye2 May 29, 2020
24ecf81
added check_out model method for rentals
dnguye2 May 29, 2020
c0f55de
fixes tests for rentals#check-in: reloads customer and video, changes…
theomoondev May 29, 2020
a3a91d0
added rentals#checkout action
dnguye2 May 29, 2020
fa85092
added rentals#checkout action for rentals controller
dnguye2 May 29, 2020
bab81df
added nominal and edge case tests for rentals#checkout action
dnguye2 May 29, 2020
0a58915
completes rentals#check-in action
theomoondev May 29, 2020
373436d
moves decrement videos_checked_out_count, increment available_invento…
theomoondev May 29, 2020
0d1d322
adds edge case test for if the customer videos_checked_out_count is 0
theomoondev May 29, 2020
b14dd41
updates rentals#check-in so it returns an error if the customer video…
theomoondev May 29, 2020
1bf8ecc
broke up validation test of checkout fields into smaller tests
dnguye2 May 29, 2020
cebbef1
reloads customer and video in after calling the rentals#check_in method
theomoondev May 29, 2020
099fce1
adds edge case test for when the video available_inventory is equal t…
theomoondev May 29, 2020
e60a97a
updates rentals#check-in so it returns an error if the video availabl…
theomoondev May 29, 2020
ee503c1
removes edge case test for available_inventory, was causing smoke tes…
theomoondev May 29, 2020
1dd02e4
dried up rental#checkout for video and customer validations and remov…
dnguye2 May 29, 2020
45751ba
Merge pull request #6 from peachmakkoli/03-lh-customer-rental-validat…
theomoondev May 29, 2020
c0c1baa
Merge pull request #5 from peachmakkoli/03-dn-video-validations-tests
dnguye2 May 29, 2020
f10365a
Merge pull request #7 from peachmakkoli/04-dn-rental-check-out
dnguye2 May 29, 2020
59abef2
Merge branch 'master' into 04-lh-rentals-check-in
theomoondev May 29, 2020
40e086d
Merge pull request #8 from peachmakkoli/04-lh-rentals-check-in
theomoondev May 29, 2020
c5de788
dries up customer controller tests using check_response helper method
theomoondev May 29, 2020
6844a5a
changed succesful created rental from status :created to have status :ok
dnguye2 May 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
.byebug_history

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.5
57 changes: 57 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development, :test do
gem 'pry-rails'
end

group :development do
gem 'guard'
gem 'guard-minitest'
gem 'debase', '>= 0.2.4.1'
gem 'ruby-debug-ide', '>= 0.7.0'
end

group :test do
gem 'minitest-rails'
gem 'minitest-reporters'
end
212 changes: 212 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.1)
actionpack (= 6.0.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.1)
actionpack (= 6.0.3.1)
activejob (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
mail (>= 2.7.1)
actionmailer (6.0.3.1)
actionpack (= 6.0.3.1)
actionview (= 6.0.3.1)
activejob (= 6.0.3.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.1)
actionview (= 6.0.3.1)
activesupport (= 6.0.3.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.1)
actionpack (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.1)
activesupport (= 6.0.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.1)
activesupport (= 6.0.3.1)
globalid (>= 0.3.6)
activemodel (6.0.3.1)
activesupport (= 6.0.3.1)
activerecord (6.0.3.1)
activemodel (= 6.0.3.1)
activesupport (= 6.0.3.1)
activestorage (6.0.3.1)
actionpack (= 6.0.3.1)
activejob (= 6.0.3.1)
activerecord (= 6.0.3.1)
marcel (~> 0.3.1)
activesupport (6.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ansi (1.5.0)
bootsnap (1.4.6)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.2)
concurrent-ruby (1.1.6)
crass (1.0.6)
debase (0.2.4.1)
debase-ruby_core_source (>= 0.10.2)
debase-ruby_core_source (0.10.9)
erubi (1.9.0)
ffi (1.12.2)
formatador (0.2.5)
globalid (0.4.2)
activesupport (>= 4.2.0)
guard (2.16.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-minitest (2.4.6)
guard-compat (~> 1.2)
minitest (>= 3.0)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.5.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.2.4)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
minitest-rails (6.0.1)
minitest (~> 5.10)
railties (~> 6.0.0)
minitest-reporters (1.4.2)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
msgpack (1.3.3)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.10.9)
mini_portile2 (~> 2.4.0)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
pg (1.2.3)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
puma (4.3.5)
nio4r (~> 2.0)
rack (2.2.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.1)
actioncable (= 6.0.3.1)
actionmailbox (= 6.0.3.1)
actionmailer (= 6.0.3.1)
actionpack (= 6.0.3.1)
actiontext (= 6.0.3.1)
actionview (= 6.0.3.1)
activejob (= 6.0.3.1)
activemodel (= 6.0.3.1)
activerecord (= 6.0.3.1)
activestorage (= 6.0.3.1)
activesupport (= 6.0.3.1)
bundler (>= 1.3.0)
railties (= 6.0.3.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.1)
actionpack (= 6.0.3.1)
activesupport (= 6.0.3.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (13.0.1)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
ruby-debug-ide (0.7.2)
rake (>= 0.8.1)
ruby-progressbar (1.10.1)
shellany (0.0.1)
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (4.0.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (1.0.1)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
websocket-driver (0.7.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
zeitwerk (2.3.0)

PLATFORMS
ruby

DEPENDENCIES
bootsnap (>= 1.4.2)
byebug
debase (>= 0.2.4.1)
guard
guard-minitest
listen (~> 3.2)
minitest-rails
minitest-reporters
pg (>= 0.18, < 2.0)
pry-rails
puma (~> 4.1)
rails (~> 6.0.3, >= 6.0.3.1)
ruby-debug-ide (>= 0.7.0)
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data

RUBY VERSION
ruby 2.6.5p114

BUNDLED WITH
2.1.4
9 changes: 9 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
guard :minitest, autorun: false, spring: true do
watch(%r{^app/(.+).rb$}) { |m| "test/#{m[1]}_test.rb" }
watch(%r{^app/controllers/application_controller.rb$}) { 'test/controllers' }
watch(%r{^app/controllers/(.+)_controller.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
watch(%r{^lib/(.+).rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
watch(%r{^test/.+_test.rb$})
watch(%r{^test/test_helper.rb$}) { 'test' }
end
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'

Rails.application.load_tasks
4 changes: 4 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
4 changes: 4 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ApplicationController < ActionController::API
end
Empty file added app/controllers/concerns/.keep
Empty file.
8 changes: 8 additions & 0 deletions app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class CustomersController < ApplicationController
def index
customers = Customer.order(:name)

render json: customers.as_json(only: [:id, :name, :registered_at, :postal_code, :phone, :videos_checked_out_count]),
status: :ok
end
end
Loading