Fork of OAuth4Tw to use mbed's official EthernetInterface and HTTPClient
Fork of OAuth4Tw by
OAuth4Tw.cpp@1:b3501683b856, 2015-04-30 (annotated)
- Committer:
- vpcola
- Date:
- Thu Apr 30 10:19:31 2015 +0000
- Revision:
- 1:b3501683b856
- Parent:
- 0:0048b264a3ad
Fork of OAuth4Tw to use normal EthernetInterface and HTTPClient library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takahashim | 0:0048b264a3ad | 1 | #include "OAuth4Tw.h" |
takahashim | 0:0048b264a3ad | 2 | #include "mbed.h" |
takahashim | 0:0048b264a3ad | 3 | #include "oauth.h" |
takahashim | 0:0048b264a3ad | 4 | |
takahashim | 0:0048b264a3ad | 5 | OAuth4Tw::OAuth4Tw(const char *c_key, const char *c_secret, |
takahashim | 0:0048b264a3ad | 6 | const char *t_key, const char *t_secret) |
takahashim | 0:0048b264a3ad | 7 | :consumer_key(c_key), |
takahashim | 0:0048b264a3ad | 8 | consumer_secret(c_secret), |
takahashim | 0:0048b264a3ad | 9 | token_key(t_key), |
takahashim | 0:0048b264a3ad | 10 | token_secret(t_secret) { } |
takahashim | 0:0048b264a3ad | 11 | |
takahashim | 0:0048b264a3ad | 12 | std::string OAuth4Tw::url_escape(const char *str) { |
takahashim | 0:0048b264a3ad | 13 | return oauth_url_escape(str); |
takahashim | 0:0048b264a3ad | 14 | } |
takahashim | 0:0048b264a3ad | 15 | |
takahashim | 0:0048b264a3ad | 16 | std::string OAuth4Tw::post(const char *uri, std::string postarg) { |
takahashim | 0:0048b264a3ad | 17 | |
takahashim | 0:0048b264a3ad | 18 | std::string req_url; |
takahashim | 0:0048b264a3ad | 19 | std::string postres; |
takahashim | 0:0048b264a3ad | 20 | |
takahashim | 0:0048b264a3ad | 21 | req_url = oauth_sign_url2(uri, &postarg, OA_HMAC, 0, |
takahashim | 0:0048b264a3ad | 22 | consumer_key, consumer_secret, token_key, token_secret); |
takahashim | 0:0048b264a3ad | 23 | printf("req_url2:%s\n", req_url.c_str()); |
takahashim | 0:0048b264a3ad | 24 | |
takahashim | 0:0048b264a3ad | 25 | postres = oauth_http_post(req_url.c_str(), postarg.c_str()); |
takahashim | 0:0048b264a3ad | 26 | return postres; |
takahashim | 0:0048b264a3ad | 27 | } |
takahashim | 0:0048b264a3ad | 28 |