Class: Qa::LinkedData::ResponseHeaderService

Inherits:
Object
  • Object
show all
Defined in:
app/services/qa/linked_data/response_header_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header:, results:, config:, graph:) ⇒ ResponseHeaderService

Returns a new instance of ResponseHeaderService.

Parameters:

  • request_header (Hash)

    request attributes constructed by Qa::LinkedData::RequestHeaderService

  • results (String, JSON)

    results generated by executing a request

  • config (String)

    authority configuration identifying where in the results or request_header data can be found

  • graph (RDF::Graph)

    graph holding results



14
15
16
17
18
19
# File 'app/services/qa/linked_data/response_header_service.rb', line 14

def initialize(request_header:, results:, config:, graph:)
  @request_header = request_header
  @results = results
  @config = config
  @graph = graph
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'app/services/qa/linked_data/response_header_service.rb', line 8

def config
  @config
end

#graphObject (readonly)

Returns the value of attribute graph.



8
9
10
# File 'app/services/qa/linked_data/response_header_service.rb', line 8

def graph
  @graph
end

#request_headerObject (readonly)

Returns the value of attribute request_header.



8
9
10
# File 'app/services/qa/linked_data/response_header_service.rb', line 8

def request_header
  @request_header
end

#resultsObject (readonly)

Returns the value of attribute results.



8
9
10
# File 'app/services/qa/linked_data/response_header_service.rb', line 8

def results
  @results
end

Instance Method Details

#fetch_headerObject

Construct response header to pass back with fetch results (linked data module).

See Also:

  • Authorities::LinkedData::FetchTerm


36
37
38
39
40
# File 'app/services/qa/linked_data/response_header_service.rb', line 36

def fetch_header
  header = {}
  header[:predicate_count] = pred_count
  header
end

#search_headerObject

Construct response header to pass back with search results (linked data module).



24
25
26
27
28
29
30
31
# File 'app/services/qa/linked_data/response_header_service.rb', line 24

def search_header
  header = {}
  header[:start_record] = start_record
  header[:requested_records] = requested_records
  header[:retrieved_records] = retrieved_records
  header[:total_records] = total_record_count
  header
end