Git Product home page Git Product logo

whither's Introduction

README

This is a basic Ruby on Rails app to display weather for a specified address in the US.

Configuration

This application requires two environment variables to be set with API keys.

The first is GOOGLE_MAP_API_KEY, which is used to get information about the entered address such as the zipcode and geographic coordinates. Instructions for getting a key can be found at https://cloud.google.com/docs/authentication/api-keys.

The second required variable is OPENWEATHER_API_KEY. This is used to retrieve weather information for the coordinates obtained from the previous API. Instructions for creating these API keys can be found at https://openweathermap.org/api.

Running

This application was developed using Ruby version 3.2.2, and it is recommended that Ruby 3.2.x is used to run it. It may work with other versions, but that hasn't been tested.

bundle # Install dependencies specified in `Gemfile`
rails dev:cache # Toggle caching in dev mode to on (assuming it wasn't already on)
rails server # Start development-mode server

The last command there will display a URL, which you can open in your web browser to use the application.

Class descriptions

Models

Temperature

A simple class to represent a temperature. It supports any of the following temperature scales:

  • Kelvin
  • Degrees Celsius
  • Degrees Fahrenheit

Read and write acccessors are available for all of those scales. When initializing, the desired scale can be passed as a Symbol in the second argument with :kelvin being the default.

ApiClient concern

Some common functionality for working with the geolocation and weather APIs.

Location

Use a geolocation API to get zipcode and coordinates for an address passed as a String.

Weather

Use an API to get weather information for a Location. The passed location must respond to the following methods:

  • #zipcode
  • #latitude
  • #longitude

Controllers

Weather

Present a form for the user to enter an address, and display weather at that address.

whither's People

Contributors

aschrab avatar

Watchers

 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.