Class: SigepWeb::PostageCardStatus

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

Instance Method Summary collapse

Methods inherited from WebServiceInterfaceApi

#process

Constructor Details

#initialize(postage_number_card:) ⇒ PostageCardStatus

Returns a new instance of PostageCardStatus.



5
6
7
8
9
# File 'lib/sigep_web/postage_card_status.rb', line 5

def initialize(postage_number_card:)
  @postage_number_card = postage_number_card

  super()
end

Instance Method Details

#requestObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sigep_web/postage_card_status.rb', line 11

def request
  authenticate = SigepWeb.configuration.authenticate

  response = process(:get_status_cartao_postagem,
    numeroCartaoPostagem: @postage_number_card,
    usuario: authenticate.user,
    senha: authenticate.password
  ).to_hash[:get_status_cartao_postagem_response][:return]

  { success: true, response: response }
rescue Savon::SOAPFault => e
  { success: false, error: e.message }
end