You will be creating a simple user management API using the tools described below.
Create API endpoints that enable the following:
- Albums creating and deleting albums changing album details (name, artist, album art) adding / removing songs Artists (musicians/bands) creating and deleting artists changing artist details (name, bio, albums)
- Songs creating and deleting songs changing song details (name, duration, genre, album, artist, etc) songs can be featured and featured songs have a here image and extra texts to describe or promote it
- Playlists creating and deleting playlists changing playlist name adding / removing songs from playlist
The API should be written in Ruby Rails and/or an API framework such as Grape The information should be stored in a database of your choice
- Install RVM (https://rvm.io/rvm/install)
- Run
rvm install 2.3.3
- Run
gem install bundler
- Clone repository
cd api-test
- Run
bundle install
- Duplicate .env.development.sample file and rename to .env.development
- Enter correct env values for .env.development
- Repeat steps 7 and 8 for env.test
- To start ruby server, run
make run
Note: Be sure to set database url for env.test to your test database and not your development database. Tests will truncate all tables in the test database before running!
Grape: https://github.com/ruby-grape/grape
Grape Entity: https://github.com/ruby-grape/grape-entity
Grape Swagger: https://github.com/ruby-grape/grape-swagger
Sequel: http://sequel.jeremyevans.net/
Hanami: https://github.com/hanami/validations
Uses dry validation as the syntax to validate inputs. Suggested reading: http://dry-rb.org/gems/dry-validation/
Rspec: http://www.relishapp.com/rspec/rspec-core/docs
Factory Girl: https://github.com/thoughtbot/factory_girl
Faker: https://github.com/stympy/faker
To create a migration: bundle exec rake "db:migration[my_migration]"
To code the migration: go to application/migrate/XXXXXX_my_migration.rb
-- instructions here: https://github.com/jeremyevans/sequel/blob/master/doc/migration.rdoc
To apply the migration: bundle exec rake db:migrate
To apply the migration to your test database: RACK_ENV=test bundle exec rake db:migrate
Run your tests using:
update DATABASE_URL in env.test
createdb sample_test
RACK_ENV=test rake db:migrate
bundle exec rake spec