1
1
(ns twitter
2
2
(:use [clojure.contrib.json :only [read-json]]
3
- [clojure.contrib.str-utils :only [re-gsub ]]
3
+ [clojure.string :only [replace ]]
4
4
[clojure.contrib.java-utils :only [as-str]])
5
5
(:require [clojure.set :as set]
6
6
[com.twinql.clojure.http :as http]
7
7
[twitter.query :as query]
8
- [oauth.client :as oauth])
8
+ [oauth.client :as oauth]
9
+ [oauth.signature])
9
10
(:import (java.io File)
10
11
(org.apache.http.entity.mime.content FileBody)
11
12
(org.apache.http.entity.mime MultipartEntity)))
@@ -50,7 +51,7 @@ take any required and optional arguments and call the associated Twitter method.
50
51
rest-map# (apply hash-map rest#)
51
52
provided-optional-params# (set/intersection (set ~optional-params)
52
53
(set (keys rest-map#)))
53
- query-param-names# (sort (map (fn [x#] (keyword (re-gsub #"-" " _" (name x#))))
54
+ query-param-names# (sort (map (fn [x#] (keyword (replace #"-" " _" (name x#))))
54
55
(concat ~required-params provided-optional-params#)))
55
56
query-params# (apply hash-map (interleave query-param-names#
56
57
(vec (concat ~required-fn-params
@@ -63,8 +64,8 @@ take any required and optional arguments and call the associated Twitter method.
63
64
*oauth-access-token-secret*
64
65
~req-method
65
66
req-uri#
66
- (into {} (map (fn [[k# v#]] [k# (oauth/url-encode v#)]) query-params#))))]
67
- ; (into {} (map (fn [k# v#] [k# (oauth/url-encode v#)]) query-params#))
67
+ (into {} (map (fn [[k# v#]] [k# (oauth.signature /url-encode v#)]) query-params#))))]
68
+ ; (into {} (map (fn [k# v#] [k# (oauth.signature /url-encode v#)]) query-params#))
68
69
(~handler (~(symbol " http" (name req-method))
69
70
req-uri#
70
71
:query (merge query-params#
@@ -340,7 +341,7 @@ take any required and optional arguments and call the associated Twitter method.
340
341
[]
341
342
(comp #(:content %) status-handler)))
342
343
343
- (defn update-profile-image [image]
344
+ (defn update-profile-image [^String image]
344
345
(let [req-uri__9408__auto__ " http://api.twitter.com/1/account/update_profile_image.json"
345
346
346
347
oauth-creds__9414__auto__ (when
@@ -371,7 +372,7 @@ take any required and optional arguments and call the associated Twitter method.
371
372
[:title ]
372
373
(comp #(:content %) status-handler)))
373
374
374
- (defn update-profile-background-image [image & rest__2570__auto__]
375
+ (defn update-profile-background-image [^String image & rest__2570__auto__]
375
376
(let [req-uri__2571__auto__ " http://api.twitter.com/1/account/update_profile_background_image.json"
376
377
rest-map__2572__auto__ (apply hash-map rest__2570__auto__)
377
378
provided-optional-params__2573__auto__ (set/intersection
@@ -384,7 +385,7 @@ take any required and optional arguments and call the associated Twitter method.
384
385
(fn
385
386
[x__2575__auto__]
386
387
(keyword
387
- (re-gsub
388
+ (replace
388
389
#"-"
389
390
" _"
390
391
(name
@@ -609,7 +610,7 @@ the Twitter API."
609
610
(request [] (body " request" ))
610
611
(remaining-requests [] (headers " X-RateLimit-Remaining" ))
611
612
(rate-limit-reset [] (java.util.Date.
612
- (headers " X-RateLimit-Reset" ))))))))
613
+ (long ( headers " X-RateLimit-Reset" ) ))))))))
613
614
614
615
(defn make-rate-limit-handler
615
616
" Creates a handler that will only be called if the API rate limit has been exceeded."
0 commit comments