fix(common): AuthenticationType implements Str

Instead of an arbitrary `url()` method with the signature of
`to_slice()`
This commit is contained in:
Sebastian Thiel
2015-02-27 15:06:50 +01:00
parent 646a94ac11
commit aa030e8987
3 changed files with 4 additions and 4 deletions

View File

@@ -23,9 +23,9 @@ pub enum AuthenticationType {
Device,
}
impl AuthenticationType {
impl Str for AuthenticationType {
/// Converts itself into a URL string
pub fn url(&self) -> &'static str {
fn as_slice(&self) -> &'static str {
match *self {
AuthenticationType::Device => "https://accounts.google.com/o/oauth2/device/code",
}

View File

@@ -150,7 +150,7 @@ impl<NC> DeviceFlow<NC>
.collect::<String>()
.as_slice())].iter().cloned());
match self.client.post(AuthenticationType::Device.url())
match self.client.post(AuthenticationType::Device.as_slice())
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
.body(req.as_slice())
.send() {

View File

@@ -68,7 +68,7 @@ impl<NC> RefreshFlow<NC>
.iter().cloned());
let json_str =
match self.client.post(auth_type.url())
match self.client.post(auth_type.as_slice())
.header(ContentType("application/x-www-form-urlencoded".parse().unwrap()))
.body(req.as_slice())
.send() {