Class: GitHub::Browser
- Inherits:
-
Object
- Object
- GitHub::Browser
- Includes:
- Singleton
- Defined in:
- lib/github_api/browser.rb
Overview
Handles low-level HTTP requests
Class Method Summary collapse
-
.base_uri ⇒ String
Returnes root uri for GitHub API.
-
.get(uri) ⇒ String
Runs HTTP GET request at given uri.
-
.post(uri, options = {}) ⇒ String
Runs HTTP POST requests with options such as GitHub::User.auth_info.
Class Method Details
.base_uri ⇒ String
Returnes root uri for GitHub API
8 9 10 |
# File 'lib/github_api/browser.rb', line 8 def self.base_uri "http://github.com/api/v2/yaml" end |
.get(uri) ⇒ String
Runs HTTP GET request at given uri
15 16 17 18 19 |
# File 'lib/github_api/browser.rb', line 15 def self.get(uri) uri = uri.gsub(" ","+") puts "Requesting #{URI.parse(self.base_uri + uri)}" Net::HTTP.get URI.parse(self.base_uri + uri) end |
.post(uri, options = {}) ⇒ String
Runs HTTP POST requests with options such as GitHub::User.auth_info
24 25 26 27 28 |
# File 'lib/github_api/browser.rb', line 24 def self.post(uri, = {}) uri = uri.gsub(" ","+") puts "Requesting #{URI.parse(self.base_uri + uri)} with options: #{}" Net::HTTP.post_form URI.parse(self.base_uri + uri), end |