Sha256: 9cc2c30284011366d25d10fc93a1aa199bf2ca569b924ffbdec9d438d85b52b0

Contents?: true

Size: 963 Bytes

Versions: 2

Compression:

Stored size: 963 Bytes

Contents

module HackerOne
  module Client
    module ResourceHelper
      def self.included(base)
        base.extend(self)
      end

      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

2 entries across 2 versions & 1 rubygems

Version Path
hackerone-client-0.11.0 lib/hackerone/client/resource_helper.rb
hackerone-client-0.10.0 lib/hackerone/client/resource_helper.rb