Sha256: 1edf5d8f7f2ff86d2e932a9a398aac8b5e66a1539274e1043de8638b9932da74
Contents?: true
Size: 685 Bytes
Versions: 2
Compression:
Stored size: 685 Bytes
Contents
module AppleNews module Request class Delete attr_reader :url def initialize(url, config = AppleNews.config) @config = 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.delete(@url, headers) res.code == '204' ? true : JSON.parse(res.body) end private def headers security = AppleNews::Security.new('DELETE', @url.to_s, @config) { 'Authorization' => security.authorization } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
apple-news-0.5.1 | lib/apple-news/requests/delete.rb |
apple-news-0.5.0 | lib/apple-news/requests/delete.rb |