lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.0.48 vs lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.0.49
- old
+ new
@@ -1,14 +1,23 @@
+require_relative 'handler_accessors'
+
module Soaspec
+
# Inherit this for a class describing how to implement a particular exchange.
# Has basic methods common for methods defining RSpec tests in YAML
class ExchangeHandler
+ extend Soaspec::HandlerAccessors
# Retrieve the name of the template file to be used in the API request
attr_reader :template_name
+ # Explicitly defined elements for which a path has been predefined
+ def elements
+ @elements || []
+ end
+
# Set instance variable name
# @param [String, Symbol] name Name used when describing API test
# @param [Hash] options Parameters defining handler. Used in descendants
def initialize(name = self.class.to_s, options = {})
use
@@ -28,9 +37,10 @@
use
@name.to_s
end
# Set the request option type and the template name
+ # Erb is used to parse the template file, executing Ruby code in `<%= %>` blocks to work out the final request
# @param [String] name Name of file inside 'template' folder excluding extension
def template_name=(name)
@request_option = :template
@template_name = name
end
\ No newline at end of file