Module: Inferno::DSL::RequestStorage

Defined in:
lib/inferno/dsl/request_storage.rb

Overview

This module handles storing and retrieving requests/responses made by FHIR/HTTP clients

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#load_tagged_requests(*tags) ⇒ Inferno::Entities::Request

Returns requests which match all of the given tags

Parameters:

  • tags (String)

Returns:



43
44
45
46
47
48
49
# File 'lib/inferno/dsl/request_storage.rb', line 43

def load_tagged_requests(*tags)
  return [] if tags.blank?

  Repositories::Requests.new.tagged_requests(test_session_id, tags).tap do |tagged_requests|
    requests.concat(tagged_requests)
  end
end

#requestInferno::Entities::Request?

Returns the most recent FHIR/HTTP request

Returns:



20
21
22
# File 'lib/inferno/dsl/request_storage.rb', line 20

def request
  requests.last
end

#requestsArray<Inferno::Entities::Request>

Returns the FHIR/HTTP requests that have been made in this Test

Returns:



13
14
15
# File 'lib/inferno/dsl/request_storage.rb', line 13

def requests
  @requests ||= []
end

#resourceFHIR::Model?

Returns the FHIR resource from the response to the most recent FHIR request

Returns:



35
36
37
# File 'lib/inferno/dsl/request_storage.rb', line 35

def resource
  request&.resource
end

#responseHash?

Returns the response from the most recent FHIR/HTTP request

Returns:

  • (Hash, nil)


27
28
29
# File 'lib/inferno/dsl/request_storage.rb', line 27

def response
  request&.response
end