Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

implement save method for Gist backend

  • Loading branch information...
commit b663e2ec19894676ecee87308ae040958d177a73 1 parent a5e88ee
Jimmy Cuadra authored July 17, 2011

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. 18  lib/boom/storage/gist.rb
18  lib/boom/storage/gist.rb
@@ -63,7 +63,7 @@ def bootstrap
63 63
         end
64 64
 
65 65
         @storage = JSON.parse(response["files"]["boom.json"]["content"]) if response["files"] and response["files"]["boom.json"]
66  
-        Boom.config.attributes["gist"]["gist_id"] = response["id"]
  66
+        Boom.config.attributes["gist"]["gist_id"] = @gist_id = response["id"]
67 67
         Boom.config.save
68 68
 
69 69
         unless @storage
@@ -87,7 +87,23 @@ def populate
87 87
       end
88 88
 
89 89
       def save
  90
+        params = {
  91
+          :basic_auth => {
  92
+            :username => @username,
  93
+            :password => @password
  94
+          },
  95
+          :body => JSON.generate({
  96
+            :description => "Data for Boom",
  97
+            :public => false,
  98
+            :files => {
  99
+              "boom.json" => {
  100
+                "content" => JSON.generate(to_hash)
  101
+              }
  102
+            }
  103
+          })
  104
+        }
90 105
 
  106
+        response = self.class.post("https://api.github.com/gists/#{@gist_id}", params)
91 107
       end
92 108
     end
93 109
   end

0 notes on commit b663e2e

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