davidrhyswhite / rust-firebase

Rust based library for working with Firebase.
MIT License
55 stars 9 forks source link

&self -> self. Authentication, Javascript-like API, Tests, Small Tweaks & Style #1

Closed illegalprime closed 9 years ago

illegalprime commented 9 years ago

This makes reusing the Firebase object possible (since it is not moved then destroyed).

    let firebase = Firebase::new("https://shining-torch-7752.firebaseio.com");
    let res = firebase.set("/users/david.json", "{\"firstName\":\"Dave\"}");
    println!("Response body: {:?}", res.body);
    println!("Response code: {:?}", res.code);
    println!("Response success: {:?}", res.is_success());

    let res = firebase.get("/users/david.json");
    println!("Response body: {:?}", res.body);
    println!("Response code: {:?}", res.code);
    println!("Response success: {:?}", res.is_success());
illegalprime commented 9 years ago

API Changes make this library more like the Javascript API:

let firebase = Firebase::new("https://shining-torch-7752.firebaseio.com");
let david = firebase.at("/users/david.json");

let res = david.set("{\"firstName\":\"Dave\"}");
println!("Response body: {:?}", res.body);
println!("Response code: {:?}", res.code);
println!("Response success: {:?}", res.is_success());

let res = david.get();
println!("Response body: {:?}", res.body);
println!("Response code: {:?}", res.code);
println!("Response success: {:?}", res.is_success());
illegalprime commented 9 years ago

Now authentication has been implemented, and users do not have to add the ".json" extension in the path explicitly anymore!

illegalprime commented 9 years ago

REST query parameters have been implemented!

davidrhyswhite commented 9 years ago

Looks good, my first crack at this project was using an unofficial Ruby gem as a reference point (https://github.com/oscardelben/firebase-ruby). I'd considered restructuring to be more similar to the JavaScript API, just hadn't found the time to do so.

I think my only comment would be changing the delete() method to remove() to keep it consistent with the JavaScript API.

davidrhyswhite commented 9 years ago

Forgot to say awesome work though, I'd be more than happy to add you as an author.

illegalprime commented 9 years ago

How do you update crates.io?

davidrhyswhite commented 9 years ago

I've updated crates.io now, there's no way in that system to add users to publish but I'm thinking since you're now showing as an author you might be able to publish in the future.