Module: ExchangeHandlerDefaults

Included in:
Soaspec::ExchangeHandler
Defined in:
lib/soaspec/exchange_handlers/exchange_handler_defaults.rb

Overview

Default values set for methods on ExchangeHandler

Instance Method Summary collapse

Instance Method Details

#convert_to_lower?Boolean

Returns Whether all xpaths will be done with XML that is converted to lower case.

Returns:

  • (Boolean)

    Whether all xpaths will be done with XML that is converted to lower case



27
28
29
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 27

def convert_to_lower?
  false
end

#expected_mandatory_elementsArray

Will be used in ‘success_scenarios’ shared examples. Set though ‘mandatory_elements’ method

Returns:

  • (Array)

    Array of symbols specifying element names



8
9
10
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 8

def expected_mandatory_elements
  []
end

#expected_mandatory_json_valuesHash

Change this through ‘mandatory_json_values’ method to specify json results that must be present in the response Will be used in ‘success_scenarios’ shared examples

Returns:

  • (Hash)

    Hash of ‘json/path’ => ‘expected value’ pairs



22
23
24
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 22

def expected_mandatory_json_values
  {}
end

#expected_mandatory_xpath_valuesHash

Change this through ‘mandatory_xpath_values’ method to specify xpath results that must be present in the response Will be used in ‘success_scenarios’ shared examples

Returns:

  • (Hash)

    Hash of ‘xpath’ => ‘expected value’ pairs



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

def expected_mandatory_xpath_values
  {}
end

#request(response) ⇒ Object

Request of API call. Either intended request or actual request

Parameters:

  • response (Object)

    Response from calling exchange



38
39
40
41
42
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 38

def request(response)
  return "Request not yet sent Request option is #{@request_option}" unless response

  'Specific API handler should implement this'
end

#retry_exception_limitInteger

Set this through ‘retry_on_exceptions’ on ExchangeHandler

Returns:

  • (Integer)

    Times to retry before raising exception. Default of 3



58
59
60
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 58

def retry_exception_limit
  3
end

#retry_on_exceptionsArray

Set through ‘retry_on_exceptions’ method

Returns:

  • (Array)

    List of exceptions to retry for



46
47
48
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 46

def retry_on_exceptions
  []
end

#retry_pause_timeInteger

Set this through ‘retry_on_exceptions’ on ExchangeHandler

Returns:

  • (Integer)

    Time to wait before retrying each request. Default of 1



52
53
54
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 52

def retry_pause_time
  1
end

#strip_namespaces?Boolean

Returns Whether to remove namespaces in xpath assertion automatically.

Returns:

  • (Boolean)

    Whether to remove namespaces in xpath assertion automatically



32
33
34
# File 'lib/soaspec/exchange_handlers/exchange_handler_defaults.rb', line 32

def strip_namespaces?
  false
end