Sha256: 9d83b7f7ba6ed1373694e93f04169b819b478f55c8b41ba32af8f8af22e5ee97
Contents?: true
Size: 508 Bytes
Versions: 2
Compression:
Stored size: 508 Bytes
Contents
module Adminix module Helpers module HTTP def self.get(path) config = Adminix::Config.instance uri = URI.parse("#{config.host}/v1/#{path}") request = Net::HTTP::Get.new(uri) request['Authorization'] = "Bearer #{config.secret_key}" opts = { use_ssl: uri.scheme == 'https' } response = Net::HTTP.start(uri.hostname, uri.port, opts) do |http| http.request(request) end JSON.parse(response.body) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adminix-0.1.49 | lib/adminix/helpers/http.rb |
adminix-0.1.48 | lib/adminix/helpers/http.rb |