Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Downloads finally work. Thanks to dakrone for putting hardcore effort…

… into getting this stuff working in clj-http.
  • Loading branch information...
commit 56dd38fc497cb644075fc3d52751ea5aa37b338e 1 parent e15c4d0
Anthony Grimes authored

Showing 2 changed files with 9 additions and 5 deletions. Show diff stats Hide diff stats

  1. +1 1  project.clj
  2. +8 4 src/tentacles/repos.clj
2  project.clj
... ... @@ -1,6 +1,6 @@
1 1 (defproject tentacles "0.1.0-SNAPSHOT"
2 2 :description "A library for working with the Github API."
3 3 :dependencies [[clojure "1.3.0"]
4   - [clj-http "0.2.5-SNAPSHOT"]
  4 + [clj-http "0.2.5"]
5 5 [cheshire "2.0.2"]
6 6 [slingshot "0.9.0"]])
12 src/tentacles/repos.clj
@@ -209,7 +209,12 @@
209 209 [user repo id options]
210 210 (nil? (api-call :delete "repos/%s/%s/downloads/%s" [user repo id] options)))
211 211
212   -(defn download-resource [user repo path options]
  212 +;; Github uploads are a two step process. First we get a download resource and then
  213 +;; we use that to upload the file.
  214 +(defn download-resource
  215 + "Get a download resource for a file you want to upload. This will be
  216 + passed to upload-file to actually upload your file."
  217 + [user repo path options]
213 218 (let [path (file path)]
214 219 (assoc (api-call :post "repos/%s/%s/downloads"
215 220 [user repo]
@@ -222,8 +227,7 @@
222 227 "Upload a file given a download resource obtained from download-resource."
223 228 [resp]
224 229 (post (:s3_url resp)
225   - {:debug true
226   - :multipart [["key" (:path resp)]
  230 + {:multipart [["key" (:path resp)]
227 231 ["acl" (:acl resp)]
228 232 ["success_action_status" "201"]
229 233 ["Filename" (:name resp)]
@@ -231,7 +235,7 @@
231 235 ["Policy" (:policy resp)]
232 236 ["Signature" (:signature resp)]
233 237 ["Content-Type" (:mime_type resp)]
234   - ["file" (file (:filepath resp))]]}))
  238 + ["file" (:filepath resp)]]}))
235 239
236 240 ;; Repo Forks API
237 241

0 comments on commit 56dd38f

Please sign in to comment.
Something went wrong with that request. Please try again.