Skip to content

BabsLabs/code_songs_microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeSongs Microservice

Description

Find the perfect song for your codebase with CodeSongs!

CodeSongs allows a user to select a GitHub repository and a musical artist and then "Songify" their code to find that artists best matching songs for the code. To do so CodeSongs uses IBM's Watson Tone Analyzer to identify the occurring sentiments in the code as well as in the selected artists top songs. CodeSongs then uses a proprietary algorithm to match the repo with the best suited songs.

This repository is for the CodeSongs Microservice. For the other part of CodeSongs see the repository page on GitHub.

Purpose

The purpose of this project was to practice OAuth, Database Design, Background Workers / Cron Tasks, and API calls, and to build a postgresql database with Sinatra.

Focus Areas

  • Consuming a number of various APIs
  • Authenticated API calls
  • Building features on Greenfield Code
  • Building a Microservice
  • Building a postgresql database in Sinatra
  • Writing a cron task to automatically make API calls to seed and update database
  • Test driven development
  • Project planning
  • Work with a deadline
  • Prioritizing code functionality vs best practices

APIs Used

Tech/Framework Used

The CodeSongs Microservice is written in Ruby with Sinatra, uses a postgresql database, and is hosted on Heroku with the Travis CI integration tool.

Gems

The following Ruby Gems are used in this project:

Database

Database Diagram

Database Diagram

Database Setup

Local Environment:

  • bundle exec rake db:create
  • bundle exec rake db:migrate
  • bundle exec rake db:seed

Run Locally:

  • bundle exec rackup config.ru

Test Environment:

  • RACK_ENV=test bundle exec rake db:{migrate,seed}

Running Tests:

  • You can run the full testing suite with the command bundle exec rspec

  • You can run an individual test using bundle exec rspec <path-to-file>

Using Fiagro or DOTENV in development and testing:

Keep environment variables secure by using Figaro to generate an appliation.yml file or by saving a .env file in the root directory. See more information about using the figaro gem at or https://github.com/laserlemon/figaro the dotenv gem at https://github.com/bkeepers/.

Required Environment Variables

Environment variables and required API keys/tokens (in Figaro format) :

  1. YouTube API key defined as ENV['YOUTUBE_API_TOKEN']
  2. GitHub Token defined as ENV['GITHUB_TEST_TOKEN']
  3. MusixMatch Token defined as ENV['MUSIX_MATCH_TOKEN']
  4. Watson Token defined as ENV['WATSON_TOKEN']
  5. Watson Instance defined as ENV['WATSON_INSTANCE']

Refreshing VCR Test Cassettes

From time to time you may receive an error when testing with the VCR. You can delete the cassettes directory from your spec folder and run bundle exec rspec to refresh the cassettes used. More information on VCR cassettes can be found in the VCR documentation.

Versions

  • Ruby 2.4.1
  • Rails 5.2.4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages