summaryrefslogtreecommitdiff
path: root/lib/dashing/downloader.rb
blob: 140e86265b339909f72384b9441f14a9cc873ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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