Sha256: cf006760c0ddfaf6486cf34cb561f986d75ac0938a133c998d04d8c343d0901f

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

class Evergreen
  module Mixins
    # This read-only API is available
    # without any credentials
    module AnonymousPcrud
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
evergreen-ils-0.2.0 lib/evergreen/mixins/anonymous_pcrud.rb