diff --git a/src/common.rs b/src/common.rs index e43a9a6..526fb88 100644 --- a/src/common.rs +++ b/src/common.rs @@ -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", } diff --git a/src/device.rs b/src/device.rs index cfc6dc0..cf400f4 100644 --- a/src/device.rs +++ b/src/device.rs @@ -150,7 +150,7 @@ impl DeviceFlow .collect::() .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() { diff --git a/src/refresh.rs b/src/refresh.rs index 4838ffe..90250fd 100644 --- a/src/refresh.rs +++ b/src/refresh.rs @@ -68,7 +68,7 @@ impl RefreshFlow .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() {