Module: Fgi::HttpRequests

Included in:
Configuration, GitService, Tokens
Defined in:
lib/fgi/http_requests.rb

Instance Method Summary collapse

Instance Method Details

#get(url:, headers: nil) ⇒ String

Generic method to GET requests

Parameters:

  • url (String)

    the given Git service API url for GET request

  • headers (Hash) (defaults to: nil)

    the headers to set for the request

Returns:

  • (String)

    the received response from the Git service API



9
10
11
# File 'lib/fgi/http_requests.rb', line 9

def get(url:, headers: nil)
  http_request(verb: :get, url: url, headers: headers)
end

#post(url:, headers: nil, body: nil) ⇒ String

Generic method to POST requests

Parameters:

  • url (String)

    the given Git service API url for POST request

  • headers (Hash) (defaults to: nil)

    the headers to set for the request

  • body (Hash) (defaults to: nil)

    the body to set for the request

Returns:

  • (String)

    the received response from the Git service API



18
19
20
# File 'lib/fgi/http_requests.rb', line 18

def post(url:, headers: nil, body: nil)
  http_request(verb: :post, url: url, headers: headers, body: body)
end