Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
afecfb7
Created a new api app
TheresaManney May 9, 2017
c614219
Created routes
RanaSulaiman May 9, 2017
f247da5
Re-added seeds.rb info
TheresaManney May 9, 2017
d7b53c6
Created customers model
TheresaManney May 9, 2017
340cc82
Created movie model
RanaSulaiman May 9, 2017
30c4743
Merge branch 'rs/creating_movie_model'
RanaSulaiman May 9, 2017
50e6f1b
Figured out how to migrate new models
TheresaManney May 9, 2017
5d35156
Added model relationships
TheresaManney May 9, 2017
a34634a
Merge pull request #1 from TheresaManney/tam/model_relationships
TheresaManney May 9, 2017
4ca5183
zomg works
RanaSulaiman May 9, 2017
d0b1786
Merge pull request #2 from TheresaManney/rs/zomg
RanaSulaiman May 9, 2017
1c32ed8
Completed movie model validation tests
TheresaManney May 9, 2017
48e909b
Completed customer model validations tests
TheresaManney May 9, 2017
1bc9fbe
Added index method to movies_controller
RanaSulaiman May 9, 2017
759e6cf
Merge pull request #3 from TheresaManney/tam/model_tests
TheresaManney May 9, 2017
fcdcb06
Merge pull request #4 from TheresaManney/rs/movies_controller
RanaSulaiman May 9, 2017
f8e7122
commented out movie and customer relationships
TheresaManney May 9, 2017
49486bb
Added show method
RanaSulaiman May 9, 2017
ca6e245
Added index method
RanaSulaiman May 9, 2017
e55135d
fixed index method
RanaSulaiman May 10, 2017
52b2ce2
A few test cases for custommers controller
RanaSulaiman May 10, 2017
242ac55
More testing for customers controller
RanaSulaiman May 10, 2017
4c898f5
Completed movies controller tests, need negative tests for movies index
TheresaManney May 10, 2017
d8e060a
Added a negative test for movies controllertest index action
TheresaManney May 10, 2017
5105991
Negative test case for customers_controller
RanaSulaiman May 10, 2017
4854f41
Merge pull request #5 from TheresaManney/tam/movies_controller_tests
TheresaManney May 10, 2017
ed899b1
Merge branch 'master' of https://github.com/TheresaManney/VideoStoreAPI
RanaSulaiman May 10, 2017
e013339
Created more specific error messages and fixed out tests accordingly
TheresaManney May 10, 2017
008c83c
Added bibding-color gem
RanaSulaiman May 10, 2017
ed08994
Merge branch 'master' of https://github.com/TheresaManney/VideoStoreAPI
RanaSulaiman May 10, 2017
1190704
Created rental model and defined the related relationships
RanaSulaiman May 10, 2017
b889a4b
Created foreign keys for rentals and fixed the rentals table
TheresaManney May 10, 2017
50392cd
New migration to add returned:boolean to rental model
RanaSulaiman May 11, 2017
295e1ce
Added rentals#checkout and the corresponding route
RanaSulaiman May 11, 2017
13419ab
Added availble_inventory column to movie table and updated all to be …
RanaSulaiman May 11, 2017
3702eb0
Added simolecov gem
RanaSulaiman May 12, 2017
b5da230
Changed check_in date in rental fixtures
RanaSulaiman May 12, 2017
ff54e6f
ChangeDueDateType to datetime
RanaSulaiman May 12, 2017
b198da7
Working on customer relationship tests
TheresaManney May 12, 2017
bb4e386
created a movie model relationship test
TheresaManney May 12, 2017
2e2d76a
Testing rental_model
RanaSulaiman May 12, 2017
f62cb81
Fixed simplecoverage
RanaSulaiman May 12, 2017
ea778aa
Created new negative tests for customer model to loop through each va…
TheresaManney May 12, 2017
8b6d07a
Merge branch 'tam/customer_model'
TheresaManney May 12, 2017
55f16cb
Fixed model relationship tests and added more validations to the movi…
TheresaManney May 12, 2017
4af15aa
Tests for rentals#checkout passed, 100% coverage
RanaSulaiman May 12, 2017
b9aef12
worked on before action logic to find movies and a customer for renta…
TheresaManney May 12, 2017
b71628e
Checkout is working and tested !
TheresaManney May 12, 2017
b0a87e1
Added more validation tests for movies
TheresaManney May 14, 2017
6ce9db6
Finished Post Rentals#checkin
RanaSulaiman May 14, 2017
91ba639
Testing for rentals#checkin WIP
RanaSulaiman May 14, 2017
acf14d1
Testing for rentals#checkin is done
RanaSulaiman May 14, 2017
e0a2fad
Cleaned up the code
RanaSulaiman May 15, 2017
372f7a4
Merge branch 'master' into rs/rentals_controller4
RanaSulaiman May 15, 2017
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
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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 Byebug command history file.
.byebug_history
# Ignore coverage
/coverage/
60 changes: 60 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end

gem 'binding_of_caller'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.2'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# 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', platform: :mri
gem 'pry-rails'
end

group :development do
gem 'listen', '~> 3.0.5'
# 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 do
gem 'better_errors'

gem 'rails-erd'

end

gem 'awesome_print'
gem 'foundation-rails'

group :test do
gem 'minitest-rails'
gem 'minitest-reporters'
gem 'simplecov'

end
195 changes: 195 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.2)
actionpack (= 5.0.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.2)
actionview (= 5.0.2)
activesupport (= 5.0.2)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.2)
activesupport (= 5.0.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.2)
activesupport (= 5.0.2)
globalid (>= 0.3.6)
activemodel (5.0.2)
activesupport (= 5.0.2)
activerecord (5.0.2)
activemodel (= 5.0.2)
activesupport (= 5.0.2)
arel (~> 7.0)
activesupport (5.0.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
ansi (1.5.0)
arel (7.1.4)
awesome_print (1.7.0)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.3)
byebug (9.0.6)
choice (0.2.0)
coderay (1.1.1)
concurrent-ruby (1.0.5)
debug_inspector (0.0.2)
docile (1.1.5)
erubis (2.7.0)
execjs (2.7.0)
ffi (1.9.18)
foundation-rails (6.3.1.0)
railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5)
sprockets-es6 (>= 0.9.0)
globalid (0.4.0)
activesupport (>= 4.2.0)
i18n (0.8.1)
json (2.0.2)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.5)
mime-types (>= 1.16, < 4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.1)
minitest-rails (3.0.0)
minitest (~> 5.8)
railties (~> 5.0)
minitest-reporters (1.1.14)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
nio4r (2.0.0)
nokogiri (1.7.1)
mini_portile2 (~> 2.1.0)
pg (0.20.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.6)
pry (>= 0.10.4)
puma (3.8.2)
rack (2.0.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.2)
actioncable (= 5.0.2)
actionmailer (= 5.0.2)
actionpack (= 5.0.2)
actionview (= 5.0.2)
activejob (= 5.0.2)
activemodel (= 5.0.2)
activerecord (= 5.0.2)
activesupport (= 5.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.2)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6)
rails-erd (1.5.0)
activerecord (>= 3.2)
activesupport (>= 3.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.2)
actionpack (= 5.0.2)
activesupport (= 5.0.2)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
ruby-graphviz (1.2.3)
ruby-progressbar (1.8.1)
sass (3.4.23)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.4)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)

PLATFORMS
ruby

DEPENDENCIES
awesome_print
better_errors
binding_of_caller
byebug
foundation-rails
listen (~> 3.0.5)
minitest-rails
minitest-reporters
pg (~> 0.18)
pry-rails
puma (~> 3.0)
rails (~> 5.0.2)
rails-erd
simplecov
spring
spring-watcher-listen (~> 2.0.0)
tzinfo-data

BUNDLED WITH
1.14.6
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.
10 changes: 10 additions & 0 deletions app/controllers/customers_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CustomersController < ApplicationController
def index
customers = Customer.all
if customers.length > 1
render json: customers.as_json(only: [:id, :name, :registered_at, :postal_code, :phone]), status: :ok
else
render json: {no_customers: "Customers were not found"}, status: :not_found
end
end
end
24 changes: 24 additions & 0 deletions app/controllers/movies_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class MoviesController < ApplicationController
# def zomg
# render json: "it works!"
# end

def index
movies = Movie.all
if movies.length > 1
render json: movies.as_json(only: [:title, :release_date]), status: :ok
else
render json: { no_movies: "Movies were not found" }, status: :not_found
end
end

def show
movie = Movie.find_by(title: params[:title])
# raise
if movie
render json:movie.as_json(except: [:created_at,:updated_at]),status: :ok
else
render json: {errors: {title: ["Movie '#{params[:title]}' not found"]} }, status: :not_found
end
end
end
Loading