Class: SigepWeb::GenerateLabelsDigitVerifier

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

Instance Method Summary collapse

Methods inherited from WebServiceInterfaceApi

#process

Constructor Details

#initialize(options = {}) ⇒ GenerateLabelsDigitVerifier

Returns a new instance of GenerateLabelsDigitVerifier.



3
4
5
6
# File 'lib/sigep_web/generate_labels_digit_verifier.rb', line 3

def initialize(options = {})
  @labels = options[:labels]
  super()
end

Instance Method Details

#requestObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sigep_web/generate_labels_digit_verifier.rb', line 8

def request
  authenticate = SigepWeb.configuration.authenticate
  begin
    response = process(:gera_digito_verificador_etiquetas, {
      etiquetas: @labels,
      usuario: authenticate.user,
      senha: authenticate.password
    }).to_hash[:gera_digito_verificador_etiquetas_response][:return]

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