Sha256: b1089b911213ac625e1cd35f1ba0160d31b3bb04ea225dcf15c8751bafeb2ccb
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
require 'httparty' require_relative 'base_adapter' require_relative '../ui' module Gitlab module Triage module NetworkAdapters class HttpartyAdapter < BaseAdapter def get(token, url) response = HTTParty.get( url, headers: { 'Content-type' => 'application/json', 'PRIVATE-TOKEN' => token } ) if response.response.is_a?(Net::HTTPUnauthorized) puts Gitlab::Triage::UI.debug response.inspect if options.debug raise 'The provided token is unauthorized!' end { more_pages: (response.headers["x-next-page"] != ""), next_page_url: url + "&page=#{response.headers['x-next-page']}", results: response.parsed_response } end def post(token, url, body) HTTParty.post( url, body: { body: body }.to_json, headers: { 'Content-type' => 'application/json', 'PRIVATE-TOKEN' => token } ) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems