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
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
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!!!
Setting Up the Cloverly-Microservice
-
Clone this repo
git clone https://github.com/Carbon-Knight/cloverly_microservice.git
-
Enter the directory it was cloned into
cd cloverly_microservice
-
Run
bundle install
to install gems and dependencies -
At this point, please visit Configuration Part II to get the full Carbon Knight Application up and running locally
To view a sample response, after at least completing the configuration steps up to and including #3,
-
In the command line run
ruby lib/cloverly_microservice.rb
This will spin up your local server. -
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!
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.
See Open Issues or visit our Project Board for a list of proposed features, known issues, and project extensions.
Contributions are what make this community such an amazing and fun place to learn, grow, and create! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch
git checkout -b feature/NewGreatFeature
- Commit your Changes
git commit -m 'Add some NewGreatFeature'
- Push to the Branch
git push origin feature/NewGreatFeature
- Open a new Pull Request!
Curtis Bartell - - GitHub
Jonathan Wilson - - GitHub
Carson Jardine - - GitHub
Eugene Theriault - - GitHub
Roberto Basulto - - GitHub
James Belta - - GitHub
Joshua Carey - - GitHub
Kiera Allen - - GitHub
Sean Steel - - GitHub
Project Link: Carbon Knight