Class: SigepWeb::RequestPlpServices

Inherits:
WebServiceInterfaceApi show all
Defined in:
lib/sigep_web/request_plp_services.rb

Instance Method Summary collapse

Methods inherited from WebServiceInterfaceApi

#process

Constructor Details

#initialize(options = {}) ⇒ RequestPlpServices

Returns a new instance of RequestPlpServices.



3
4
5
6
7
8
9
# File 'lib/sigep_web/request_plp_services.rb', line 3

def initialize(options = {})
  @plp = options[:plp]
  @id_plp_client = options[:id_plp_client]
  #@post_card = options[:post_card]
  @labels = options[:labels]
  super()
end

Instance Method Details

#requestObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sigep_web/request_plp_services.rb', line 11

def request
  authenticate = SigepWeb.configuration.authenticate
  begin
    response = process(:fecha_plp_varios_servicos, {
      xml: @plp.to_xml,
      idPlpCliente: @id_plp_client,
      cartaoPostagem: authenticate.card,
      listaEtiquetas: @labels,
      usuario: authenticate.user,
      senha: authenticate.password
    }).to_hash[:fecha_plp_varios_servicos_response][:return].to_s

    {
      success: true,
      response: response
    }
  rescue Savon::SOAPFault => msg
    {
      success: false,
      error: msg
    }
  end
end