Class: SigepWeb::RequestLabels

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

Instance Method Summary collapse

Methods inherited from WebServiceInterfaceApi

#process

Constructor Details

#initialize(options = {}) ⇒ RequestLabels

Returns a new instance of RequestLabels.



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

def initialize(options = {})
  @receiver_type = options[:receiver_type]
  @identifier    = options[:identifier]
  @id_service    = options[:id_service]
  @qt_labels     = options[:qt_labels]
  super()
end

Instance Method Details

#requestObject



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

def request
  authenticate = SigepWeb.configuration.authenticate
  begin
    response = process(:solicita_etiquetas, {
      tipoDestinatario: @receiver_type,
      identificador: @identifier,
      idServico: @id_service,
      qtdEtiquetas: @qt_labels,
      usuario: authenticate.user,
      senha: authenticate.password
    }).to_hash[:solicita_etiquetas_response][:return]

    build_label_array(response)
  rescue Savon::SOAPFault => msg
    msg
  end
end