Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6e16453
updated reqwest to 0.9
simeonschaub Feb 6, 2019
4cc390f
updated url to 1.7
simeonschaub Feb 6, 2019
364489d
Made `weather_types` public
simeonschaub Feb 7, 2019
eb769a8
made `temp_kf` optional because crashes somtimes otherwise
simeonschaub Feb 7, 2019
841f95d
Made some more variables in `Weather` be `None` by default
simeonschaub Feb 12, 2019
056307e
Update deps
caemor Oct 9, 2019
9767bcc
Work on adding more parameters like unit and lang
caemor Oct 9, 2019
be272b5
fmt
caemor Oct 9, 2019
49fd227
- Make message from Sys optional (isn't always sent)
caemor Nov 7, 2019
90e3f64
update example
caemor Nov 12, 2019
0b14412
Add .env file support for cargo test with api key
caemor Nov 12, 2019
bcedd84
Add Settings/Parameters for units and language
caemor Nov 12, 2019
9cf1772
Fix a few weather types
caemor Nov 12, 2019
4a39eae
-version change & cargo fmt
caemor Nov 12, 2019
183c1c2
Make Unit & Language public
caemor Nov 14, 2019
4e8e062
Only borrow LocationSpecifier
caemor Nov 14, 2019
3b69cfa
- add default and partialeq to all weather_types
caemor Nov 15, 2019
93ba4ac
Add 'rain' and 'snow' to struct WeatherReportCurrent
nguiard Nov 25, 2019
3d96590
Merge pull request #1 from nguiard/master
caemor Nov 25, 2019
037ccde
Update api for failures
caemor Mar 18, 2020
06a6665
Update Lifetimes of LocationSpecifier
caemor Mar 22, 2020
66dbd57
Add thiserror and remove all unwraps
caemor Mar 23, 2020
9f1d849
Improved Errortype
caemor Mar 23, 2020
4fea978
Improved Error message
caemor Mar 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

.env

# Vim backup files
**/*.swp
22 changes: 16 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openweather"
version = "0.0.1"
version = "0.1.0"
authors = ["Broderick Carlin <[email protected]>"]
description = "A rust crate wrapping openweather's API into a simple easy to use interface"
repository = "https://github.com/BroderickCarlin/openweather"
Expand All @@ -9,15 +9,25 @@ keywords = ["openweather", "openweathermaps", "weather", "api"]
categories = ["api-bindings", "science"]
license = "MIT"
license-file = "LICENSE-MIT"
edition = "2018"

[lib]
name = "openweather"
path = "src/lib.rs"

[dependencies]
reqwest = "0.8.6"
log = "0.4.8"

http_req = {version = "0.5.3", default-features = false, features = ["rust-tls"]}

serde_json = "1.0"
serde = "1.0.70"
serde_derive = "1.0.70"
time = "0.1.40"
url = "1.5.1"
serde = "1.0.101"
serde_derive = "1.0.101"

time = "0.1.42"
url = "2.1.0"
thiserror = "1.0.13"


[dev-dependencies]
dotenv = "0.15.0"
21 changes: 13 additions & 8 deletions examples/right_now.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
extern crate openweather;

use openweather::LocationSpecifier;
use openweather::{LocationSpecifier, Settings};
static API_KEY: &str = "YOUR_API_KEY_HERE";

fn main()
{
let loc = LocationSpecifier::CityAndCountryName{city:"Minneapolis", country:"USA"};
let weather = openweather::get_current_weather(loc, API_KEY).unwrap();
fn main() -> Result<(), openweather::Error> {
let loc = LocationSpecifier::CityAndCountryName {
city: "Minneapolis".to_string(),
country: "USA".to_string(),
};
match openweather::get_current_weather(&loc, API_KEY, &Settings::default()) {
Ok(weather) => println!("Right now in Minneapolis, MN it is {}K", weather.main.temp),
Err(e) => println!("Error getting weather: {}", e),
}
let weather = openweather::get_current_weather(&loc, API_KEY, &Settings::default())?;
println!("Right now in Minneapolis, MN it is {}K", weather.main.temp);
}
Ok(())
}
Loading