Skip to content

Latest commit

 

History

History
182 lines (115 loc) · 7.79 KB

README.md

File metadata and controls

182 lines (115 loc) · 7.79 KB

Cloverly Microservice

Contributors Forks Stargazers Issues Build Status

Cloverly Microservice

This is a microservice that was built to provide information about carbon footprints for the Carbon Knight application.
Explore the docs »

· Report Bug · Request Feature

Table of Contents

About The Project

Please visit the Carbon Knight Front End repository and check out the readme there for a more in depth look at this project!

This microservice is able to take in information about a particular trip and will provide the approximate carbon used for that trip in kilograms along with the cost to offset that carbon. It does this by recieving query parameters from the Carbon Knight Backend, makes a call to the Cloverly API using these parameters, and then packages up the API response and sends that back to the Carbon Knight Backend in the proper format.

This micro services uses the Cloverly API. Read the API documentation here

To view all the repositories associated with Carbon Knight, please visit Carbon Knight

Built With

Getting Started

To properly use this application you will need to set up and configure three repositories. Follow the Configuration directions in each repository to get Carbon Knight running locally! Alternatively, check out the production application here!!!

Configuration

Setting Up the Cloverly-Microservice

  1. Clone this repo git clone https://github.com/Carbon-Knight/cloverly_microservice.git

  2. Enter the directory it was cloned into cd cloverly_microservice

  3. Run bundle install to install gems and dependencies

  4. At this point, please visit Configuration Part II to get the full Carbon Knight Application up and running locally

Usage

To view a sample response, after at least completing the configuration steps up to and including #3,

  1. In the command line run ruby lib/cloverly_microservice.rb This will spin up your local server.

  2. In your browser paste in http://localhost:4567/api/v1/carbonfootprint?fuel_efficiency=25&trip_distance=80 and you will see this response:

{
  "data": {
    "equivalent_carbon_in_kg": 28.444,
    "cloverly_offset_cost": {
        "currency": "USD",
        "total": 0.31
    }
  }
}

The two parameters used in this call are fuel_efficiency and trip_distance. From here you can edit these two parameters within the url to obtain your desired response!

Testing

RSpec was used for the testing of this project.

Cloverly Microservice has been fully tested. To view the test coverage;

Once inside your terminal within the Cloverly Microservice directory run the following command.

open coverage

This will open up a folder with an index.html file. Clicking on this file will show you a list of all the lines of code within this repository, and whether they have been tested or not.

Additionally, running bundle exec rspec will show you the quick summary of the test coverage in this application.

Both open coverage and bundle exec rspec work inside each repository of the Carbon Knight application.

Roadmap

See Open Issues or visit our Project Board for a list of proposed features, known issues, and project extensions.

Contributing

Contributions are what make this community such an amazing and fun place to learn, grow, and create! Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch git checkout -b feature/NewGreatFeature
  3. Commit your Changes git commit -m 'Add some NewGreatFeature'
  4. Push to the Branch git push origin feature/NewGreatFeature
  5. Open a new Pull Request!

Contact

Curtis Bartell        - LinkedIn - GitHub

Jonathan Wilson - LinkedIn - GitHub

Carson Jardine    - LinkedIn - GitHub

Eugene Theriault - LinkedIn - GitHub

Roberto Basulto  - LinkedIn - GitHub

James Belta         - LinkedIn - GitHub

Joshua Carey      - LinkedIn - GitHub

Kiera Allen           - LinkedIn - GitHub

Sean Steel           - LinkedIn - GitHub

Project Link: Carbon Knight