Skip to content

RubyArtm/weather_json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Weather Forecast Application

Ruby-based console application for retrieving and displaying weather forecasts and climate data via the World Weather Organization (WMO) API.

Description

This application requests weather data for a selected city, processes the JSON response, and outputs information about tomorrow's temperature forecast and average monthly climate indicators in a readable format.

Features

  • Retrieve tomorrow's weather forecast (minimum and maximum temperature)
  • Display average monthly temperature for the current month
  • Console output with formatted data

Technologies Used

  • Ruby 3.4.5 - Primary programming language
  • WMO API - Weather data source from World Weather Organization

Skills Demonstrated

1. HTTP Request Handling

  • Using Net::HTTP module to send GET requests
  • URI parsing with URI.parse
  • Working with external APIs

2. JSON Processing

  • Parsing JSON responses from API
  • Navigating nested data structures
  • Extracting specific data from complex objects

3. Date Operations

  • Using Date and DateTime libraries
  • Date formatting and manipulation
  • Current month determination

4. External API Integration

  • Integration with public WMO API
  • Extracting necessary data from structured API responses
  • Error handling for network requests

5. Data Processing

  • Data extraction and formatting
  • String interpolation
  • Console output formatting

Usage

ruby weather_json.rb

Requirements

  • Ruby 3.x or higher
  • Internet connection for API access

Project Structure

pogoda_json/

├── pogoda_json.rb # Main application file

├── city_list.txt # List of available cities with IDs

├── .gitignore # Git ignore rules

└── README.md # Project documentation

Example Output

City: Kharkiv

Temperature tomorrow from 5 °C to 12 °C

Average monthly temperature from 3 °C to 10 °C

Technical Implementation Details

The application demonstrates:

  • RESTful API consumption
  • JSON data parsing and manipulation
  • Date/time operations in Ruby
  • String formatting and interpolation
  • Ruby standard library usage (net/http, uri, json, date)

API Reference

This application uses the World Weather Organization API:

  • Base URL: https://worldweather.wmo.int/en/json/
  • Response Format: JSON
  • Data Includes: Current forecasts, climate data, temperature ranges

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages