summaryrefslogtreecommitdiff
path: root/lib/dashing/downloader.rb
diff options
context:
space:
mode:
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