lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.2.11 vs lib/soaspec/exchange_handlers/exchange_handler.rb in soaspec-0.2.12

- old
+ new

@@ -14,11 +14,11 @@ public_methods.select { |i| i[/__custom_path_.+/] } end # Set instance variable name # @param [String, Symbol] name Name used when describing API test - # @param [Hash] options Parameters defining handler. Used in descendants + # @param [Hash] _options Parameters defining handler. Used in descendants def initialize(name = self.class.to_s, _options = {}) use @request_option = :hash raise ArgumentError, 'Cannot define both template_name and default_hash' if respond_to?(:template_name_value) && respond_to?(:default_hash_value) @@ -84,23 +84,23 @@ # Stores a value in a method that can be accessed by the provided name # @param [Symbol] name Name of method to use to access this value within handler # @param [String] value Value to store def store(name, value) - define_singleton_method('__stored_val__' + name.to_s) do - value - end + define_singleton_method('__stored_val__' + name.to_s) { value } end # Set instance variable for each key in hash remove it from Hash # @param [Hash] hash with items to remove from # @param [Array] keys List of keys to remove from hash, setting each one def set_remove_keys(hash, keys) keys.each { |key| set_remove_key(hash, key) } end # Set instance variable and remove it from Hash + # @param [Hash] hash Hash to remove/retrieve keys from + # @param [String,Symbol] key Key to remove and to set instance variable for def set_remove_key(hash, key) return unless hash.key? key __send__("#{key}=", hash[key]) hash.delete key @@ -110,9 +110,10 @@ def strip_namespaces? false end # Request of API call. Either intended request or actual request + # @param [Object] response Response from calling exchange def request(response) return "Request not yet sent Request option is #{@request_option}" unless response 'Specific API handler should implement this' end