Permalink
Browse files

Merge pull request #35 from tjg/poll-interval

Add poll-interval to metadata. (From "X-Poll-Interval" events header.)
  • Loading branch information...
2 parents b0d3567 + f64f655 commit e4defc0e79c18ab670b28ea9b45526c761504c77 @Raynes committed Aug 21, 2013
Showing with 11 additions and 2 deletions.
  1. +5 −2 src/tentacles/core.clj
  2. +6 −0 test/tentacles/core_test.clj
View
@@ -33,10 +33,13 @@
(defn extract-useful-meta
[h]
- (let [{:strs [etag last-modified x-ratelimit-limit x-ratelimit-remaining]} h]
+ (let [{:strs [etag last-modified x-ratelimit-limit x-ratelimit-remaining
+ x-poll-interval]}
+ h]
{:etag etag :last-modified last-modified
:call-limit (when x-ratelimit-limit (Long/parseLong x-ratelimit-limit))
- :call-remaining (when x-ratelimit-remaining (Long/parseLong x-ratelimit-remaining))}))
+ :call-remaining (when x-ratelimit-remaining (Long/parseLong x-ratelimit-remaining))
+ :poll-interval (when x-poll-interval (Long/parseLong x-poll-interval))}))
(defn api-meta
[obj]
@@ -10,3 +10,9 @@
(is (= 60 (:call-limit (core/api-meta
(core/safe-parse {:status 200 :headers {"x-ratelimit-limit" "60"
"content-type" ""}}))))))
+
+(deftest poll-limit-details-are-propagated
+ (is (= 61 (:poll-interval (core/api-meta
+ (core/safe-parse {:status 200
+ :headers {"x-poll-interval" "61"
+ "content-type" ""}}))))))

0 comments on commit e4defc0

Please sign in to comment.