Module: Soaspec::RestExchangeFactory

Included in:
RestHandler
Defined in:
lib/soaspec/exchange_handlers/rest_exchanger_factory.rb

Overview

Convenience methods for once off usage of a REST request

Instance Method Summary collapse

Instance Method Details

#delete(params = {}) ⇒ Exchange

Make REST Exchange with ‘delete’ method within this Handler context. If merely a string is passed it will be used as the URL appended to base_url (same as suburl). Otherwise a Hash is expected

Parameters:

  • params (Hash, String) (defaults to: {})

    Exchange parameters. If String is used it will be for suburl

  • override_parameters (Hash)

    a customizable set of options

Returns:

  • (Exchange)

    Instance of Exchange class. Assertions are made by default on the response body



69
70
71
# File 'lib/soaspec/exchange_handlers/rest_exchanger_factory.rb', line 69

def delete(params = {})
  perform_exchange_with(:delete, params)
end

#get(params = {}) ⇒ Exchange

Make REST Exchange with ‘get’ method within this Handler context. If merely a string is passed it will be used as the URL appended to base_url (same as suburl). Otherwise a Hash is expected

Parameters:

  • params (Hash, String) (defaults to: {})

    Exchange parameters. If String is used it will be for suburl

  • override_parameters (Hash)

    a customizable set of options

Returns:

  • (Exchange)

    Instance of Exchange class. Assertions are made by default on the response body



57
58
59
# File 'lib/soaspec/exchange_handlers/rest_exchanger_factory.rb', line 57

def get(params = {})
  perform_exchange_with(:get, params)
end

#patch(params) ⇒ Exchange

Make REST Exchange with ‘patch’ method within this Handler context Following are for the body of the request

Parameters:

  • params (Hash, String)

    Exchange parameters. If String is used it will be for the request payload

  • override_parameters (Hash)

    a customizable set of options

Returns:

  • (Exchange)

    Instance of Exchange class. Assertions are made by default on the response body



30
31
32
# File 'lib/soaspec/exchange_handlers/rest_exchanger_factory.rb', line 30

def patch(params)
  perform_exchange_with(:patch, params)
end

#post(params = {}) ⇒ Exchange

Make REST Exchange with ‘post’ method within this Handler context Following are for the body of the request

Parameters:

  • params (Hash, String) (defaults to: {})

    Exchange parameters. If String is used it will be for the request payload

  • override_parameters (Hash)

    a customizable set of options

Returns:

  • (Exchange)

    Instance of Exchange class. Assertions are made by default on the response body



15
16
17
# File 'lib/soaspec/exchange_handlers/rest_exchanger_factory.rb', line 15

def post(params = {})
  perform_exchange_with(:post, params)
end

#put(params = {}) ⇒ Exchange

Make REST Exchange with ‘put’ method within this Handler context Following are for the body of the request

Parameters:

  • params (Hash, String) (defaults to: {})

    Exchange parameters. If String is used it will be for the request payload

  • override_parameters (Hash)

    a customizable set of options

Returns:

  • (Exchange)

    Instance of Exchange class. Assertions are made by default on the response body



45
46
47
# File 'lib/soaspec/exchange_handlers/rest_exchanger_factory.rb', line 45

def put(params = {})
  perform_exchange_with(:put, params)
end