diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..35da3dd0 Binary files /dev/null and b/.DS_Store differ diff --git a/.env b/.env new file mode 100755 index 00000000..45b29247 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +MOVIEDB_KEY = 'fab6e945ca8bd693a69acea57b30c0b9' \ No newline at end of file diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml old mode 100644 new mode 100755 index 3199c7b7..b268f032 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -20,10 +20,10 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - - name: Setup Ruby 2.6.5 + - name: Setup Ruby 2.6.6 uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6.5 + ruby-version: 2.6.6 - name: Install PostgreSQL 11 client run: | diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..338a5b5d --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.6.6 diff --git a/Gemfile b/Gemfile old mode 100644 new mode 100755 index 555e4fe2..4cfa8fb2 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.6.5' +ruby '2.6.6' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0', '>= 6.0.3.1' @@ -49,6 +49,9 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f' + + group :development, :test do gem 'pry-rails' end diff --git a/Gemfile.lock b/Gemfile.lock old mode 100644 new mode 100755 index 91cf9988..d2bd1f66 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://github.com/mimemagicrb/mimemagic.git + revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f + ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f + specs: + mimemagic (0.3.5) + GEM remote: https://rubygems.org/ specs: @@ -124,7 +131,6 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) - mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.5.0) minitest (5.14.3) @@ -230,6 +236,7 @@ DEPENDENCIES httparty jbuilder (~> 2.7) listen (~> 3.2) + mimemagic! minitest-rails minitest-reporters pg (>= 0.18, < 2.0) @@ -244,7 +251,7 @@ DEPENDENCIES will_paginate RUBY VERSION - ruby 2.6.5p114 + ruby 2.6.6 BUNDLED WITH 2.1.4 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 diff --git a/app.js b/app.js old mode 100644 new mode 100755 diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 00000000..a86c1f72 Binary files /dev/null and b/app/.DS_Store differ diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store new file mode 100644 index 00000000..a37f729f Binary files /dev/null and b/app/assets/.DS_Store differ diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js old mode 100644 new mode 100755 diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb old mode 100644 new mode 100755 diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb old mode 100644 new mode 100755 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep old mode 100644 new mode 100755 diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/rentals_controller.rb b/app/controllers/rentals_controller.rb old mode 100644 new mode 100755 diff --git a/app/controllers/videos_controller.rb b/app/controllers/videos_controller.rb old mode 100644 new mode 100755 index c9a2bb08..cca421dc --- a/app/controllers/videos_controller.rb +++ b/app/controllers/videos_controller.rb @@ -21,6 +21,22 @@ def show ) end + def create + video = Video.new( + title: params[:title], + overview: params[:overview], + release_date: params[:release_date], + image_url: params[:image_url], + inventory: 5, + external_id: params[:external_id] + ) + if video.save + render status: :ok, json: video + else + render status: :bad_request, json: { errors: rentals.errors.messages } + end + end + private def require_video diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/customers_helper.rb b/app/helpers/customers_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/rentals_helper.rb b/app/helpers/rentals_helper.rb old mode 100644 new mode 100755 diff --git a/app/helpers/videos_helper.rb b/app/helpers/videos_helper.rb old mode 100644 new mode 100755 diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb old mode 100644 new mode 100755 diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb old mode 100644 new mode 100755 diff --git a/app/models/application_record.rb b/app/models/application_record.rb old mode 100644 new mode 100755 diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep old mode 100644 new mode 100755 diff --git a/app/models/customer.rb b/app/models/customer.rb old mode 100644 new mode 100755 diff --git a/app/models/rental.rb b/app/models/rental.rb old mode 100644 new mode 100755 diff --git a/app/models/video.rb b/app/models/video.rb old mode 100644 new mode 100755 diff --git a/app/serializers/video_serializer.rb b/app/serializers/video_serializer.rb old mode 100644 new mode 100755 diff --git a/app/views/.DS_Store b/app/views/.DS_Store new file mode 100644 index 00000000..ba10fa3c Binary files /dev/null and b/app/views/.DS_Store differ diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb old mode 100644 new mode 100755 diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb old mode 100644 new mode 100755 diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb old mode 100644 new mode 100755 diff --git a/config.ru b/config.ru old mode 100644 new mode 100755 diff --git a/config/.DS_Store b/config/.DS_Store new file mode 100644 index 00000000..3113733a Binary files /dev/null and b/config/.DS_Store differ diff --git a/config/application.rb b/config/application.rb old mode 100644 new mode 100755 diff --git a/config/boot.rb b/config/boot.rb old mode 100644 new mode 100755 diff --git a/config/cable.yml b/config/cable.yml old mode 100644 new mode 100755 diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc old mode 100644 new mode 100755 diff --git a/config/database.yml b/config/database.yml old mode 100644 new mode 100755 diff --git a/config/environment.rb b/config/environment.rb old mode 100644 new mode 100755 diff --git a/config/environments/development.rb b/config/environments/development.rb old mode 100644 new mode 100755 diff --git a/config/environments/production.rb b/config/environments/production.rb old mode 100644 new mode 100755 diff --git a/config/environments/test.rb b/config/environments/test.rb old mode 100644 new mode 100755 diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb old mode 100644 new mode 100755 diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb old mode 100644 new mode 100755 diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb old mode 100644 new mode 100755 diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb old mode 100644 new mode 100755 diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb old mode 100644 new mode 100755 diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb old mode 100644 new mode 100755 diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb old mode 100644 new mode 100755 diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb old mode 100644 new mode 100755 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb old mode 100644 new mode 100755 diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb old mode 100644 new mode 100755 diff --git a/config/locales/en.yml b/config/locales/en.yml old mode 100644 new mode 100755 diff --git a/config/puma.rb b/config/puma.rb old mode 100644 new mode 100755 diff --git a/config/routes.rb b/config/routes.rb old mode 100644 new mode 100755 index 16fc2214..1111b4bf --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ resources :customers, only: [:index] - resources :videos, only: [:index, :show], param: :title + resources :videos, only: [:index, :show, :create], param: :title post "/rentals/:title/check-out", to: "rentals#check_out", as: "check_out" post "/rentals/:title/return", to: "rentals#check_in", as: "check_in" diff --git a/config/secrets.yml b/config/secrets.yml old mode 100644 new mode 100755 index b81fd05f..7fda229b --- a/config/secrets.yml +++ b/config/secrets.yml @@ -19,4 +19,4 @@ test: # Do not keep production secrets in the repository, # instead read values from the environment. production: - secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> + secret_key_base: <%= ENV["SECRET_KEY_BASE"] || 'da7849f96c38ebd65869daaa319c01acb3fb369da7c00cd7ae49b5610b65e48d23aea52b369d58394582c6500f9b51c8f0c93be3fe6b4b5c6ea0d416e3ec637d' %> diff --git a/config/spring.rb b/config/spring.rb old mode 100644 new mode 100755 diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 00000000..d32f76e8 --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/.DS_Store b/db/.DS_Store new file mode 100644 index 00000000..c6d4f19f Binary files /dev/null and b/db/.DS_Store differ diff --git a/db/migrate/20170111220114_create_customers.rb b/db/migrate/20170111220114_create_customers.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20170111220123_create_movies.rb b/db/migrate/20170111220123_create_movies.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20170111220126_create_rentals.rb b/db/migrate/20170111220126_create_rentals.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20170117221429_add_returned_status_to_rental.rb b/db/migrate/20170117221429_add_returned_status_to_rental.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20170118201517_remove_available_inventory_from_movie.rb b/db/migrate/20170118201517_remove_available_inventory_from_movie.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20170608201920_add_image_to_movie.rb b/db/migrate/20170608201920_add_image_to_movie.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20180618042754_add_external_id_to_movie.rb b/db/migrate/20180618042754_add_external_id_to_movie.rb old mode 100644 new mode 100755 diff --git a/db/migrate/20200706194441_rename_movies_to_videos.rb b/db/migrate/20200706194441_rename_movies_to_videos.rb old mode 100644 new mode 100755 diff --git a/db/schema.rb b/db/schema.rb old mode 100644 new mode 100755 diff --git a/db/seeds.rb b/db/seeds.rb old mode 100644 new mode 100755 diff --git a/db/seeds/customers.json b/db/seeds/customers.json old mode 100644 new mode 100755 diff --git a/db/seeds/videos.json b/db/seeds/videos.json old mode 100644 new mode 100755 diff --git a/lib/.DS_Store b/lib/.DS_Store new file mode 100644 index 00000000..2fa55d78 Binary files /dev/null and b/lib/.DS_Store differ diff --git a/lib/assets/.keep b/lib/assets/.keep old mode 100644 new mode 100755 diff --git a/lib/tasks/.keep b/lib/tasks/.keep old mode 100644 new mode 100755 diff --git a/lib/video_wrapper.rb b/lib/video_wrapper.rb old mode 100644 new mode 100755 diff --git a/log/.keep b/log/.keep old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/public/404.html b/public/404.html old mode 100644 new mode 100755 diff --git a/public/422.html b/public/422.html old mode 100644 new mode 100755 diff --git a/public/500.html b/public/500.html old mode 100644 new mode 100755 diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png old mode 100644 new mode 100755 diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png old mode 100644 new mode 100755 diff --git a/public/assets/.sprockets-manifest-204c8f150bcd69b5c03f155b30b15bae.json b/public/assets/.sprockets-manifest-204c8f150bcd69b5c03f155b30b15bae.json old mode 100644 new mode 100755 diff --git a/public/assets/.sprockets-manifest-22e48dabd7cc9f16f212f23c5df83e68.json b/public/assets/.sprockets-manifest-22e48dabd7cc9f16f212f23c5df83e68.json old mode 100644 new mode 100755 diff --git a/public/favicon.ico b/public/favicon.ico old mode 100644 new mode 100755 diff --git a/public/robots.txt b/public/robots.txt old mode 100644 new mode 100755 diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 00000000..4c204bd1 Binary files /dev/null and b/test/.DS_Store differ diff --git a/test/controllers/.keep b/test/controllers/.keep old mode 100644 new mode 100755 diff --git a/test/controllers/customers_controller_test.rb b/test/controllers/customers_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/controllers/rentals_controller_test.rb b/test/controllers/rentals_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/controllers/videos_controller_test.rb b/test/controllers/videos_controller_test.rb old mode 100644 new mode 100755 diff --git a/test/fixtures/.keep b/test/fixtures/.keep old mode 100644 new mode 100755 diff --git a/test/fixtures/customers.yml b/test/fixtures/customers.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep old mode 100644 new mode 100755 diff --git a/test/fixtures/rentals.yml b/test/fixtures/rentals.yml old mode 100644 new mode 100755 diff --git a/test/fixtures/videos.yml b/test/fixtures/videos.yml old mode 100644 new mode 100755 diff --git a/test/helpers/.keep b/test/helpers/.keep old mode 100644 new mode 100755 diff --git a/test/integration/.keep b/test/integration/.keep old mode 100644 new mode 100755 diff --git a/test/integration/cors_headers_test.rb b/test/integration/cors_headers_test.rb old mode 100644 new mode 100755 diff --git a/test/mailers/.keep b/test/mailers/.keep old mode 100644 new mode 100755 diff --git a/test/models/.keep b/test/models/.keep old mode 100644 new mode 100755 diff --git a/test/models/customer_test.rb b/test/models/customer_test.rb old mode 100644 new mode 100755 diff --git a/test/models/rental_test.rb b/test/models/rental_test.rb old mode 100644 new mode 100755 diff --git a/test/models/video_test.rb b/test/models/video_test.rb old mode 100644 new mode 100755 diff --git a/test/test_helper.rb b/test/test_helper.rb old mode 100644 new mode 100755 diff --git a/tmp/.keep b/tmp/.keep old mode 100644 new mode 100755 diff --git a/vendor/assets/javascripts/.keep b/vendor/assets/javascripts/.keep old mode 100644 new mode 100755 diff --git a/vendor/assets/stylesheets/.keep b/vendor/assets/stylesheets/.keep old mode 100644 new mode 100755 diff --git a/yarn.lock b/yarn.lock old mode 100644 new mode 100755