correios_sigep 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjFiOTcyYTk2ZDY4ZTljOGZlMzBmZDM0ODllZTMwNjg0NjBmZDAwOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmIyMWNhNzQzNzNjMmI5MzIxZGViOWI1MjVhMDg1OWVkYzgyOTk3MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzBmZGYzNjI1ZTgyZjkwZDZjNmUzMmNkN2UyODFiMTRlZmIyM2E2ODkzMjhl
|
10
|
+
ZTRiMTNlZjlkMmY3NjUzYjQ2ZDU3M2FhNGUyNTA2MjhhYjdkZTQxMDBkOGFj
|
11
|
+
ODc1NGExM2I0NjcyOTAwMGJkYzE0ZGM2Y2VmOTNiZGQ0NjExODU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjI0ZmEzM2FiZjk2ZjRhMmI3MTM4MmRjNGJlODMyM2YxOWMwZDA5NzVmNTBi
|
14
|
+
ZmExOWNiMWE0NTMyZDJhOTIwMGY4ODdjOWMxYmY5MzUyMGM3MTc4Y2JiOWFk
|
15
|
+
ZWUzMmVmM2YxODdhNmY2MGZlNmM4ZWI4NWViMjY5MTY5YzExYzQ=
|
@@ -15,14 +15,19 @@ module CorreiosSigep
|
|
15
15
|
private
|
16
16
|
def process_response response
|
17
17
|
correios_hash = response.body[:acompanhar_pedido_response][:return]
|
18
|
-
check_sro_errors
|
19
|
-
correios_hash[:coleta][:objeto][:numero_etiqueta] || begin raise Models::Errors::SRONotReady; end
|
18
|
+
check_sro_errors(correios_hash)
|
19
|
+
correios_response(correios_hash[:coleta][:objeto])[:numero_etiqueta] || begin raise Models::Errors::SRONotReady; end
|
20
|
+
end
|
21
|
+
|
22
|
+
def correios_response response
|
23
|
+
response.is_a?(Array) ? response.first : response
|
20
24
|
end
|
21
25
|
|
22
26
|
def check_sro_errors return_body
|
23
27
|
error_msg = return_body[:msg_erro]
|
24
28
|
case return_body[:cod_erro].to_i
|
25
29
|
when 0
|
30
|
+
return
|
26
31
|
when -7
|
27
32
|
raise Models::Errors::RequiredFields.new(error_msg)
|
28
33
|
when -5
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<S:Body>
|
4
|
+
<ns2:acompanharPedidoResponse xmlns:ns2="http://webservice.scol.correios.com.br/">
|
5
|
+
<return>
|
6
|
+
<codigo_administrativo>0808265</codigo_administrativo>
|
7
|
+
<tipo_solicitacao>A</tipo_solicitacao>
|
8
|
+
<coleta>
|
9
|
+
<numero_pedido>1234</numero_pedido>
|
10
|
+
<controle_cliente>56789</controle_cliente>
|
11
|
+
<historico>
|
12
|
+
<status>55</status>
|
13
|
+
<descricao_status>Aguardando Objeto na Agência</descricao_status>
|
14
|
+
<data_atualizacao>16-07-2015</data_atualizacao>
|
15
|
+
<hora_atualizacao>11:02:36</hora_atualizacao>
|
16
|
+
<observacao/>
|
17
|
+
</historico>
|
18
|
+
<objeto>
|
19
|
+
<numero_etiqueta>ETI12345</numero_etiqueta>
|
20
|
+
<controle_objeto_cliente>2696523</controle_objeto_cliente>
|
21
|
+
<ultimo_status>55</ultimo_status>
|
22
|
+
<descricao_status>Aguardando Objeto na Agência</descricao_status>
|
23
|
+
<data_ultima_atualizacao>16-07-2015</data_ultima_atualizacao>
|
24
|
+
<hora_ultima_atualizacao>11:02:36</hora_ultima_atualizacao>
|
25
|
+
</objeto>
|
26
|
+
<objeto>
|
27
|
+
<numero_etiqueta></numero_etiqueta>
|
28
|
+
<controle_objeto_cliente>2696523</controle_objeto_cliente>
|
29
|
+
<ultimo_status>55</ultimo_status>
|
30
|
+
<descricao_status>Aguardando Objeto na Agência</descricao_status>
|
31
|
+
<data_ultima_atualizacao>16-07-2015</data_ultima_atualizacao>
|
32
|
+
<hora_ultima_atualizacao>11:02:36</hora_ultima_atualizacao>
|
33
|
+
</objeto>
|
34
|
+
</coleta>
|
35
|
+
</return>
|
36
|
+
</ns2:acompanharPedidoResponse>
|
37
|
+
</S:Body>
|
38
|
+
</S:Envelope>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: correios_sigep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Ribeiro
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-http-persistent
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- spec/fixtures/correios/request_collect_number/response_unavailable_house_collect.xml
|
192
192
|
- spec/fixtures/correios/request_collect_number/response_unavailable_service.xml
|
193
193
|
- spec/fixtures/correios/request_collect_number/response_unexpected.xml
|
194
|
+
- spec/fixtures/correios/request_sro/response_array_success.xml
|
194
195
|
- spec/fixtures/correios/request_sro/response_collect_number_not_found.xml
|
195
196
|
- spec/fixtures/correios/request_sro/response_required_fields.xml
|
196
197
|
- spec/fixtures/correios/request_sro/response_sro_not_ready.xml
|
@@ -253,6 +254,7 @@ test_files:
|
|
253
254
|
- spec/fixtures/correios/request_collect_number/response_unavailable_house_collect.xml
|
254
255
|
- spec/fixtures/correios/request_collect_number/response_unavailable_service.xml
|
255
256
|
- spec/fixtures/correios/request_collect_number/response_unexpected.xml
|
257
|
+
- spec/fixtures/correios/request_sro/response_array_success.xml
|
256
258
|
- spec/fixtures/correios/request_sro/response_collect_number_not_found.xml
|
257
259
|
- spec/fixtures/correios/request_sro/response_required_fields.xml
|
258
260
|
- spec/fixtures/correios/request_sro/response_sro_not_ready.xml
|