Class: OpenSRF::HTTPTranslatorRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/opensrf/http_translator_request.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(configuration:, service:, payload:) ⇒ HTTPTranslatorRequest

Returns a new instance of HTTPTranslatorRequest.



12
13
14
15
16
# File 'lib/opensrf/http_translator_request.rb', line 12

def initialize(configuration:, service:, payload:)
  @configuration = configuration
  @service = service
  @payload = payload
end

Instance Method Details

#responseObject



18
19
20
21
22
23
# File 'lib/opensrf/http_translator_request.rb', line 18

def response
  raw = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
    http.request(request)
  end
  OpenSRF::ClassAndData.parse(::JSON.parse(raw.body).first, ['payload']).data
end