Module: Github::Api
- Included in:
- Organization, Repository, User
- Defined in:
- lib/github.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
10 11 12 |
# File 'lib/github.rb', line 10 def included(base) base.extend(ClassMethods) end |
Instance Method Details
#fetch ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/github.rb', line 21 def fetch uri = URI.parse("http://github.com/api/v2/json/#{path}") response = Net::HTTP.get_response(uri) data = ActiveSupport::JSON.decode(response.body) key = self.class.name.demodulize.underscore data.replace(data[key]) if data.key?(key) self.class.new(data) end |