summaryrefslogtreecommitdiff
path: root/lib/dashing/downloader.rb
diff options
context:
space:
mode:
authorpseudomuto <david.muto@gmail.com>2013-12-18 19:12:43 -0500
committerpseudomuto <david.muto@gmail.com>2013-12-18 19:12:43 -0500
commitd0eef2dbe9d1178111cd768116a66b32a3a4b2b5 (patch)
tree208b1a82ca184af59c8ac95f6541ea1cc181b588 /lib/dashing/downloader.rb
parentc3a72795ecab47f94527e079b60549051843caa4 (diff)
moving cli to lib and updating bin file
Diffstat (limited to 'lib/dashing/downloader.rb')
-rw-r--r--lib/dashing/downloader.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/dashing/downloader.rb b/lib/dashing/downloader.rb
new file mode 100644
index 0000000..140e862
--- /dev/null
+++ b/lib/dashing/downloader.rb
@@ -0,0 +1,18 @@
+require 'net/http'
+require 'open-uri'
+require 'json'
+
+module Dashing
+ module Downloader
+ extend self
+
+ def get_gist(gist_id)
+ get_json("https://api.github.com/gists/#{gist_id}")
+ end
+
+ def get_json(url)
+ response = open(url).read
+ JSON.parse(response)
+ end
+ end
+end