Sha256: f5b509574bb041840f5d8e3853a6036a4f65de5fa57b2c0b479a527411cd68ee

Contents?: true

Size: 896 Bytes

Versions: 4

Compression:

Stored size: 896 Bytes

Contents

module HackerOne
  module Client
    module ResourceHelper
      def parse_response(response)
        HackerOne::Client::Api.parse_response(response)
      end

      def make_post_request(url, request_body:)
        response = HackerOne::Client::Api.hackerone_api_connection.post do |req|
          req.headers['Content-Type'] = 'application/json'
          req.url url
          req.body = { data: request_body }.to_json
        end

        parse_response(response)
      end

      def make_get_request(url, params: {})
        response = HackerOne::Client::Api.hackerone_api_connection.get do |req|
          req.headers['Content-Type'] = 'application/json'
          req.url url
          req.params = params
        end

        parse_response(response)
      end

      private

      def api_connection
        HackerOne::Client::Api.hackerone_api_connection
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hackerone-client-0.9.1 lib/hackerone/client/resource_helper.rb
hackerone-client-0.9.0 lib/hackerone/client/resource_helper.rb
hackerone-client-0.8.0 lib/hackerone/client/resource_helper.rb
hackerone-client-0.7.0 lib/hackerone/client/resource_helper.rb