Class: Coarnotify::Http::HttpLayer

Inherits:
Object
  • Object
show all
Defined in:
lib/coarnotify/http.rb

Overview

Interface for the HTTP layer

This defines the methods which need to be implemented in order for the client to fully operate

Direct Known Subclasses

NetHttpLayer

Instance Method Summary collapse

Instance Method Details

#get(url, headers = {}, *args, **kwargs) ⇒ HttpResponse

Make an HTTP GET request to the supplied URL with the given headers

args and kwargs can be used to pass implementation-specific parameters

Parameters:

  • url (String)

    the request URL

  • headers (Hash) (defaults to: {})

    HTTP headers as a hash to include in the request

  • args (Array)

    argument list to pass on to the implementation

  • kwargs (Hash)

    keyword arguments to pass on to the implementation

Returns:

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/coarnotify/http.rb', line 36

def get(url, headers = {}, *args, **kwargs)
  raise NotImplementedError
end

#post(url, data, headers = {}, *args, **kwargs) ⇒ HttpResponse

Make an HTTP POST request to the supplied URL with the given body data, and headers

args and kwargs can be used to pass implementation-specific parameters

Parameters:

  • url (String)

    the request URL

  • data (String)

    the body data

  • headers (Hash) (defaults to: {})

    HTTP headers as a hash to include in the request

  • args (Array)

    argument list to pass on to the implementation

  • kwargs (Hash)

    keyword arguments to pass on to the implementation

Returns:

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/coarnotify/http.rb', line 23

def post(url, data, headers = {}, *args, **kwargs)
  raise NotImplementedError
end