Skip to content

Commit 3bf82ac

Browse files
committed
Remove deprecated members
TODO: Update user_timeline.rs
1 parent 50cb1cd commit 3bf82ac

File tree

4 files changed

+13
-71
lines changed

4 files changed

+13
-71
lines changed

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "oauthcli"
3-
version = "1.0.7"
3+
version = "2.0.0"
44
authors = ["azyobuzin <[email protected]>"]
55
description = "Implementation of OAuth 1.0 (and Twitter's f*ckin' OAuth) Client"
6-
documentation = "https://docs.rs/oauthcli/1.0.7/oauthcli/"
6+
documentation = "https://docs.rs/oauthcli/2.0.0/oauthcli/"
77
repository = "https://github.com/azyobuzin/rust-oauthcli"
88
readme = "README.md"
99
keywords = ["oauth"]
@@ -19,4 +19,8 @@ rand = "0.3"
1919
ring = { version = "0.11", default-features = false }
2020
time = "0.1"
2121
url = "1"
22-
hyper = { version = "0.9", default-features = false, optional = true }
22+
23+
[dev-dependencies]
24+
futures = "0.1.14"
25+
hyper = "0.11"
26+
tokio-core = "0.1.6"

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Yet Another OAuth 1.0 Client Library for Rust
66
# Features
77
- RFC 5849 implementation (without RSA-SHA1)
88
- Compatible with Twitter's (f*ckin') implementation
9-
- Integration with `hyper::header::Authorization`
109

1110
# How to Use
1211
```rust

examples/user_timeline.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#[cfg(feature = "hyper")]
1+
extern crate futures;
22
extern crate hyper;
33
extern crate oauthcli;
4-
extern crate url;
4+
extern crate tokio_core;
55

6-
#[cfg(feature = "hyper")]
76
fn main() {
87
use std::io::Read;
98
use url::Url;
@@ -27,8 +26,3 @@ fn main() {
2726

2827
println!("{}", res);
2928
}
30-
31-
#[cfg(not(feature = "hyper"))]
32-
fn main() {
33-
println!("Comple with `hyper/ssl` feature to run this example")
34-
}

src/lib.rs

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ extern crate base64;
2525
extern crate rand;
2626
extern crate ring;
2727
extern crate time;
28-
extern crate url;
29-
#[cfg(feature="hyper")] extern crate hyper;
28+
pub extern crate url;
3029

3130
#[cfg(test)] mod tests;
3231

@@ -106,8 +105,6 @@ impl fmt::Display for ParseOAuthAuthorizationHeaderError {
106105

107106
/// `Authorization` header for OAuth.
108107
///
109-
/// If you enable `"hyper"` feature, this implements `hyper::header::Scheme` trait.
110-
///
111108
/// # Example
112109
/// ```
113110
/// # use oauthcli::OAuthAuthorizationHeader;
@@ -196,17 +193,6 @@ impl std::str::FromStr for OAuthAuthorizationHeader {
196193
}
197194
}
198195

199-
#[cfg(feature="hyper")]
200-
impl hyper::header::Scheme for OAuthAuthorizationHeader {
201-
fn scheme() -> Option<&'static str> {
202-
Some("OAuth")
203-
}
204-
205-
fn fmt_scheme(&self, f: &mut fmt::Formatter) -> fmt::Result {
206-
f.write_str(&self.s)
207-
}
208-
}
209-
210196
fn base_string_url(url: &Url) -> String {
211197
let scheme = url.scheme();
212198

@@ -266,14 +252,8 @@ fn gen_timestamp() -> u64 {
266252
return x as u64;
267253
}
268254

269-
/// Generate a string for `oauth_timestamp`.
270-
#[deprecated(since = "1.0.0")]
271-
pub fn timestamp() -> String {
272-
gen_timestamp().to_string()
273-
}
274-
275255
/// Generate a string for `oauth_nonce`.
276-
pub fn nonce() -> String {
256+
fn nonce() -> String {
277257
use rand::Rng;
278258

279259
rand::thread_rng().gen_ascii_chars()
@@ -351,14 +331,14 @@ impl<'a> OAuthAuthorizationHeaderBuilder<'a> {
351331
}
352332

353333
/// Sets a custom timestamp.
354-
/// If you don't call `timestamp()`, it will use the current time.
334+
/// If you don't call `timestamp()`, the current time will be used.
355335
pub fn timestamp(&mut self, timestamp: u64) -> &mut Self {
356336
self.timestamp = Some(timestamp);
357337
self
358338
}
359339

360340
/// Sets a custom nonce.
361-
/// If you don't call `nonce()`, it will use a random string.
341+
/// If you don't call `nonce()`, a random string will be used.
362342
pub fn nonce<T: Into<Cow<'a, str>>>(&mut self, nonce: T) -> &mut Self {
363343
self.nonce = Some(nonce.into());
364344
self
@@ -489,38 +469,3 @@ impl<'a> OAuthAuthorizationHeaderBuilder<'a> {
489469
self.finish_impl(true)
490470
}
491471
}
492-
493-
/// Generate `Authorization` header for OAuth.
494-
/// The return value starts with `"OAuth "`.
495-
///
496-
/// # Panics
497-
/// This function will panic if:
498-
/// - either `token` or `token_secret` is specified.
499-
/// - `timestamp` is not valid for u64.
500-
/// - `url` is not valid for HTTP or HTTPS.
501-
#[deprecated(since = "1.0.0", note = "Use OAuthAuthorizationHeaderBuilder")]
502-
pub fn authorization_header<P>(method: &str, url: Url, realm: Option<&str>,
503-
consumer_key: &str, consumer_secret: &str, token: Option<&str>,
504-
token_secret: Option<&str>, signature_method: SignatureMethod,
505-
timestamp: &str, nonce: &str, callback: Option<&str>,
506-
verifier: Option<&str>, params: P)
507-
-> String where P: Iterator<Item = (String, String)>
508-
{
509-
let mut builder = OAuthAuthorizationHeaderBuilder::new(method, &url, consumer_key, consumer_secret, signature_method);
510-
511-
builder.request_parameters(params)
512-
.timestamp(timestamp.parse().expect("Couldn't parse `timestamp` parameter"))
513-
.nonce(nonce);
514-
515-
match (token, token_secret) {
516-
(Some(x), Some(y)) => { builder.token(x, y); },
517-
(None, None) => (),
518-
_ => panic!("Both `token` and `token_secret` parameter are required")
519-
}
520-
521-
if let Some(x) = realm { builder.realm(x); }
522-
if let Some(x) = callback { builder.callback(x); }
523-
if let Some(x) = verifier { builder.verifier(x); }
524-
525-
builder.finish().to_string()
526-
}

0 commit comments

Comments
 (0)