module HttpHandler
Public Class Methods
create_http(uri)
click to toggle source
# File lib/github_api_ruby_lib/http/http_handler.rb, line 4 def self.create_http(uri) @@http=Net::HTTP.new(uri.host,uri.port) @@http.use_ssl = true end
get_response(https,uri) { |JSON| ... }
click to toggle source
Method gets response from GET request, checks for validiation, and returns json
Attributes¶ ↑
-
https
- HTTP object sending the GET request. Must be previously initialized -
uri
- Uri object holding converted API url, used for sending GET request
# File lib/github_api_ruby_lib/http/http_handler.rb, line 16 def self.get_response(https,uri) # :yields: JSON result=https.get(uri) if result.code =="200" return JSON.parse(result.body) else raise "HTTP failed with code: #{result.code}" end end
initiate_http(uri) { |HTTP| ... }
click to toggle source