Class: JIRA::RequestClient

Inherits:
Object
  • Object
show all
Defined in:
lib/jira/request_client.rb

Overview

Base class for request clients specific to a particular authentication method.

Direct Known Subclasses

HttpClient, OauthClient

Instance Method Summary collapse

Instance Method Details

#make_multipart_request(*args) ⇒ Object

This method is abstract.

Abstract method to make a request to the JIRA server with a file upload.

Parameters:

  • args (Array)

    Arguments to pass to the request method

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/jira/request_client.rb', line 56

def make_multipart_request(*args)
  raise NotImplementedError
end

#make_request(*args) ⇒ Object

This method is abstract.

Abstract method to make a request to the JIRA server.

Parameters:

  • args (Array)

    Arguments to pass to the request method

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/jira/request_client.rb', line 49

def make_request(*args)
  raise NotImplementedError
end

#request(*args) ⇒ Net::HTTPResponse

Makes the JIRA REST API call.

Returns the response if the request was successful (HTTP::2xx) and raises a JIRA::HTTPError if it was not successful, with the response attached.

Generally you should not call this method directly, but use derived classes.

File uploads are not supported with this method. Use request_multipart instead.

Parameters:

  • args (Array)

    Arguments to pass to the request method

Returns:

  • (Net::HTTPResponse)

    The response from the server

Raises:



23
24
25
26
27
28
# File 'lib/jira/request_client.rb', line 23

def request(*args)
  response = make_request(*args)
  raise HTTPError, response unless response.is_a?(Net::HTTPSuccess)

  response
end

#request_multipart(*args) ⇒ Net::HTTPResponse

Makes a multipart request to the JIRA server.

This is used for file uploads.

Generally you should not call this method directly, but use derived classes.

Parameters:

  • args (Array)

    Arguments to pass to the request method

Returns:

  • (Net::HTTPResponse)

    The response from the server

Raises:



39
40
41
42
43
44
# File 'lib/jira/request_client.rb', line 39

def request_multipart(*args)
  response = make_multipart_request(*args)
  raise HTTPError, response unless response.is_a?(Net::HTTPSuccess)

  response
end