Git Product home page Git Product logo

university_api's Introduction

67-272: University

This project was created as means of giving students an opportunity to practice course concepts with some in-class learning exercises. There is no pretense that this is a production-ready system or that it has 100 percent test coverage -- these are for learning purposes.

This version is for an exercise in building an API endpoint. Specifically, you need to build a DepartmentSerializer that will create the JSON example found in the docs directory.

Start with the following steps:

  1. Begin by running bundle install on the command line so that you get all the gems, including the fastjson gem you need for serializing.

  2. Build the database and populate it with the context by running rails db:contexts. This will give you a series of departments, faculty, courses, and assignments to work with.

  3. If you don't have it installed already, install the JSON Formatter extension for Chrome. There is a similar JSON extension for Safari here, if that is your browser of choice.

  4. Open up the file docs/departments.json to see the JSON we want our API to generate.

  5. Open the other two serializer files in app/serializers to see what you have to work with and see other examples of serializers. Look at the structure and see where these serializers are being used in the sample JSON output right now.

  6. Create the serializer you need with the rails g serializer department command and then flesh out that serializer (using the other serializers as appropriate) so that it create the json as seen in the sample given.

  7. You can test this API endpoint out by starting the server (if you are using Codio, don't forget to configure it) and going to localhost:3000/v1/departments (or whatever address your server is running on) and seeing the JSON generated (formatted by the extension so it is readable).

Qapla'

Prof. H

P.S. -- you may find it helpful to look at the Department model and its relationships as you plan you serializer's attributes. Also, as a side note, if you had an array in Ruby with some duplicates and wanted only the unique values, you could append the .uniq method and purge duplicate elements. (This could be helpful ... wink, wink, nudge, nudge)

university_api's People

Contributors

profh avatar

Watchers

 avatar Prof. Gongora-Svartzman (Prof. GS) avatar Prof. Houda Bouamor avatar  avatar

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.