ease 0.3.0

A library for building REST clients
docs.rs failed to build ease-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: ease-0.6.1

Ease - Write REST clients in Rust Build Status

Ease simplifies the task of writing REST clients. Requests are constructed with an easy to use builder pattern and JSON responses can be automatically deserialised into a matching struct.

Examples

Make a GET call and print the result:

extern crate ease;

use ease::{Url, RestClient};

fn main() {
    let url = Url::parse("http://httpbin.org/get").unwrap();
    println!("{}",
             RestClient::new(url)
                        .get()
                        .unwrap()
            );
}

Make a POST call, parse the JSON reply in a struct, and print the struct:

#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]

extern crate serde;
extern crate ease;

use std::collections::HashMap;
use ease::{Url, RestClient};

#[derive(Deserialize, Debug)]
struct Response {
    args: HashMap<String, String>,
    data: Option<String>,
    files: HashMap<String, String>,
    form: HashMap<String, String>,
    headers: HashMap<String, String>,
    json: Option<String>,
    origin: String,
    url: String
}

fn main() {
    let url = Url::parse("http://httpbin.org/post").unwrap();
    println!("{:?}",
             RestClient::new(url)
                        .post_json_as::<Response>()
        );
}

Documentation

Documentation is available online and can be built with cargo doc for a local copy.

License

MIT