Module: Evergreen::Mixins::AnonymousPcrud

Included in:
BibRecord
Defined in:
lib/evergreen/mixins/anonymous_pcrud.rb

Overview

This read-only API is available without any credentials

Instance Method Summary collapse

Instance Method Details

#dataObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/evergreen/mixins/anonymous_pcrud.rb', line 8

def data
  return @data if @data
  return unless @id && @configuration && idl_class && idl_fields

  payload = OpenSRF::ClassAndData.new(klass: 'osrfMessage', data: {
                                        'method' => "open-ils.pcrud.retrieve.#{idl_class}",
                                        'params' => ['ANONYMOUS', @id.to_s]
                                      }).to_h
  response = OpenSRF::HTTPTranslatorRequest.new(payload: payload, configuration: @configuration,
                                                service: 'open-ils.pcrud').response
  @data = OpenSRF::ClassAndData.parse(response['content']).data
end