Class: QaServer::TermScenario

Inherits:
AuthorityScenario show all
Includes:
ERB::Util
Defined in:
app/models/qa_server/term_scenario.rb

Constant Summary

Constants inherited from AuthorityScenario

AuthorityScenario::DEFAULT_SUBAUTH, AuthorityScenario::MIN_EXPECTED_SIZE

Instance Attribute Summary collapse

Attributes inherited from AuthorityScenario

#authority, #authority_name, #min_result_size, #service, #subauthority_name

Instance Method Summary collapse

Methods inherited from AuthorityScenario

#context?

Constructor Details

#initialize(authority:, authority_name:, authority_scenario_config:, scenario_config:) ⇒ TermScenario

Returns a new instance of TermScenario.

Parameters:

  • authority (Qa::Authorities::LinkedData::GenericAuthority)

    the instance of the QA authority

  • authoity_name (Symbol)

    the name of the authority the scenario tests (e.g. :AGROVOC_DIRECT)

  • authority_scenario_config (Hash)

    configurations from the yml file that pertain to all scenarios regardless of type

  • scenario_config (Hash)

    configuration from the yml file that are specific to a term scenario



16
17
18
19
20
21
# File 'app/models/qa_server/term_scenario.rb', line 16

def initialize(authority:, authority_name:, authority_scenario_config:, scenario_config:)
  super
  @identifier = scenario_config['identifier']
  @subauthority_name = scenario_config['subauth'] || DEFAULT_SUBAUTH
  @min_result_size = scenario_config['min_result_size'] || MIN_EXPECTED_SIZE
end

Instance Attribute Details

#identifierString (readonly)

Returns id or uri of the term being fetched by this scenario.

Returns:

  • (String)

    id or uri of the term being fetched by this scenario



10
11
12
# File 'app/models/qa_server/term_scenario.rb', line 10

def identifier
  @identifier
end

Instance Method Details

#urlString

Generate an example URL that can be called in a browser or through curl

Returns:

  • (String)

    the example URL



25
26
27
# File 'app/models/qa_server/term_scenario.rb', line 25

def url
  authority.term_id_expects_uri? ? fetch_url : show_url
end