Sha256: 9722faddb885cff1ad86a55bb36120399e2b6a3731cfda9f3f151f906c5d23dd
Contents?: true
Size: 623 Bytes
Versions: 13
Compression:
Stored size: 623 Bytes
Contents
module AppleNews module Request class Get attr_reader :url def initialize(url) @config = AppleNews.config @url = URI::parse(File.join(@config.api_base, url)) end def call(params = {}) http = Net::HTTP.new(@url.hostname, @url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER res = http.get(@url, headers) JSON.parse(res.body) end private def headers security = AppleNews::Security.new('GET', @url.to_s) { 'Authorization' => security.authorization } end end end end
Version data entries
13 entries across 13 versions & 1 rubygems