Module: CircleCI::CLI::Networking::HTTPClient
- Defined in:
- lib/circleci/cli/networking/http_client.rb
Class Method Summary collapse
Class Method Details
.get(url, headers = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/circleci/cli/networking/http_client.rb', line 10 def self.get(url, headers = {}) uri = URI(url) req = Net::HTTP::Get.new(uri) headers.each { |key, value| req[key] = value } res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(req) end JSON.parse(res.body) end |
.post_form(url, params = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/circleci/cli/networking/http_client.rb', line 20 def self.post_form(url, params = {}) uri = URI(url) res = Net::HTTP.post_form(uri, params) JSON.parse(res.body) end |