Class: RubyJmeter::Plugins::JsonPathExtractor

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/ruby-jmeter/plugins/json_path_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#enabled, #enabled_disabled, #update, #update_at_xpath, #update_collection

Constructor Details

#initialize(params = {}) ⇒ JsonPathExtractor

Returns a new instance of JsonPathExtractor.


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby-jmeter/plugins/json_path_extractor.rb', line 6

def initialize(params={})
  testname = params.kind_of?(Array) ? 'XpathExtractor' : (params[:name] || 'XpathExtractor')
  @doc = Nokogiri::XML(<<-EOF.strip_heredoc)
    <com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor guiclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.gui.JSONPathExtractorGui" testclass="com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor" testname="[email protected] - JSON Path Extractor" enabled="true">
      <stringProp name="VAR"></stringProp>
      <stringProp name="JSONPATH"></stringProp>
    </com.atlantbh.jmeter.plugins.jsonutils.jsonpathextractor.JSONPathExtractor>
  EOF
  update params
  update_at_xpath params if params.is_a?(Hash) && params[:update_at_xpath]
end

Instance Attribute Details

#docObject

Returns the value of attribute doc


4
5
6
# File 'lib/ruby-jmeter/plugins/json_path_extractor.rb', line 4

def doc
  @doc
end