Giter VIP home page Giter VIP logo

code_songs_microservice's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.