correios_sigep 0.2.4 → 0.2.5
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 +8 -8
- data/README.md +106 -1
- data/lib/correios_sigep/logistic_reverse/request_collect_number.rb +2 -2
- data/lib/correios_sigep/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI0YjllYmVmNWNmMjI5MmEzYjdkOWQ3MDc4Yzc0ZmEwY2QzNzZlNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmRkZDgxODAyYzYxMzY5MTMzMDVlZDNhMzk2ZDYxYjhmNzgxMjMzMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGFiOTMwMDRmMmJkNzE2MDMxNjg5OGM5YzQ1NmE0NDUzZDc5ZGY2ZDY2ZDg3
|
10
|
+
ZGYyOTM2YjY3YWZlODViNjRkYWZlMGY0MWJkOTc0ZmYwNDA1OTI1NjNlMzUw
|
11
|
+
YzQwOTEyZDE2ODk5YmQ5OGU3MDZjYjVmZWY5NTM4MWYwZjE1Yzg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWY2ZTFhNDBhZTJjOTdiODUyM2NhYzNkMTU4MWQ4ZGVmMTQzZTBkYzg1ZmIy
|
14
|
+
YjFhY2VjMTkyZDc4NWRhOTViNTc3NWE4MjM2NGM2NjBmYTUxZjQ5YTgwZDIy
|
15
|
+
Y2E5NGM1YTczMjI2ZTA0NmZiMTk0YmJjZTAyMzYxY2FkODEwODM=
|
data/README.md
CHANGED
@@ -26,9 +26,114 @@ Ou instale manualmente com:
|
|
26
26
|
|
27
27
|
$ gem install correios_sigep
|
28
28
|
|
29
|
+
## Utilizando
|
30
|
+
|
31
|
+
### Configurando
|
32
|
+
Para utilizar a gem, é necessário configurar os campos necessários com base nos dados contrato com os Correios.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
CorreiosSigep.configure do |config|
|
36
|
+
config.user = '60618043'
|
37
|
+
config.password = '8o8otn'
|
38
|
+
config.administrative_code = '08082650'
|
39
|
+
config.card = '0057018901'
|
40
|
+
config.contract = '9912208555'
|
41
|
+
config.service_code = '41076'
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
Se for necessário, é possível adicionar também um proxy.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
config.proxy = 'http://px.myproxy.com'
|
49
|
+
```
|
50
|
+
|
51
|
+
### Logistica Reversa
|
52
|
+
|
53
|
+
#### Solicitar Postagem Reversa
|
54
|
+
(pg. 36 da documentação)
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
recipient = CorreiosSigep::Models::Recipient.new({
|
58
|
+
address: 'Endereco',
|
59
|
+
area_code: 'DDD',
|
60
|
+
city: 'Cidade',
|
61
|
+
complement: 'Complemento',
|
62
|
+
email: 'Email',
|
63
|
+
name: 'Nome',
|
64
|
+
neighborhood: 'Bairro',
|
65
|
+
number: 'Numero',
|
66
|
+
phone: 'Telefone',
|
67
|
+
postal_code: 'CEP',
|
68
|
+
reference: 'Referencia',
|
69
|
+
state: 'Estado'
|
70
|
+
})
|
71
|
+
sender = CorreiosSigep::Models::Sender.new({
|
72
|
+
address: 'Endereco',
|
73
|
+
area_code: 'DDD',
|
74
|
+
city: 'Cidade',
|
75
|
+
complement: 'Complemento',
|
76
|
+
email: 'Email',
|
77
|
+
name: 'Nome',
|
78
|
+
neighborhood: 'Bairro',
|
79
|
+
number: 'Numero',
|
80
|
+
phone: 'Telefone',
|
81
|
+
postal_code: 'CEP',
|
82
|
+
reference: 'Referencia',
|
83
|
+
state: 'Estado'
|
84
|
+
})
|
85
|
+
objects = [
|
86
|
+
{
|
87
|
+
item: 'Item',
|
88
|
+
id: '1',
|
89
|
+
description: 'Descricao',
|
90
|
+
num: '',
|
91
|
+
},
|
92
|
+
{
|
93
|
+
item: 'Item',
|
94
|
+
id: '2',
|
95
|
+
description: 'Descricao',
|
96
|
+
num: '',
|
97
|
+
}
|
98
|
+
]
|
99
|
+
|
100
|
+
# Produto: pag 67 da documentação oficial dos correios
|
101
|
+
product = CorreiosSigep::Models::Product.new({
|
102
|
+
code: '116600403',
|
103
|
+
type: '0',
|
104
|
+
quantity: 1
|
105
|
+
})
|
106
|
+
collect = CorreiosSigep::Models::Collect.new({
|
107
|
+
aditional_service: '10.00',
|
108
|
+
ag: '5',
|
109
|
+
ar: '1',
|
110
|
+
card: '',
|
111
|
+
checklist: '2',
|
112
|
+
client_id: '102030',
|
113
|
+
declared_value: '1000.00',
|
114
|
+
description: 'Descricao',
|
115
|
+
number: '',
|
116
|
+
type: 'A'
|
117
|
+
}.merge(sender: sender, objects: objects, product: product))
|
118
|
+
|
119
|
+
logistic_reverse = CorreiosSigep::Models::LogisticReverse.new(recipient: recipient, collect: collect)
|
120
|
+
collect_number = CorreiosSigep::LogisticReverse::RequestCollectNumber.new(logistic_reverse).process
|
121
|
+
|
122
|
+
```
|
123
|
+
|
124
|
+
#### Possíveis erros mapeados
|
125
|
+
```ruby
|
126
|
+
TICKET_ALREADY_USED = 195 # NÚMERO DE E-TICKET JÁ UTILIZA
|
127
|
+
UNAVAILABLE_SERVICE = 210 # SERVIÇO INDISPONÍVEL NO MOMENTO
|
128
|
+
INEXISTENT_ZIPCODE = 113 # CEP DO DESTINATÁRIO INEXISTENTE
|
129
|
+
UNAVAILABLE_HOUSE_COLLECT = 111 # COLETA DOMICILIAR NÃO DISPONÍVEL PARA O SERVIÇO SEDEX 10
|
130
|
+
COLLECT_NOT_ANSWERED_FOR_THE_ZIPCODE = 117 # CEP DO REMETENTE INEXISTENTE
|
131
|
+
NOT_CONFIGURED_CLIENT = 105 # CLIENTE NÃO CONFIGURADO PARA USAR O SISTEMA
|
132
|
+
```
|
133
|
+
|
29
134
|
## Contributing
|
30
135
|
|
31
|
-
1. Fork it ( https://github.com/
|
136
|
+
1. Fork it ( https://github.com/duduribeiro/correios_sigep/fork )
|
32
137
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
138
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
139
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -51,8 +51,8 @@ module CorreiosSigep
|
|
51
51
|
raise Models::Errors::NotConfiguredClient.new error_message
|
52
52
|
|
53
53
|
else
|
54
|
-
error_message = result_node.search('//msg-erro | //msg_erro').text
|
55
|
-
invalid_xml_message = response_doc.search("//return").text
|
54
|
+
error_message = result_node.search('//msg-erro | //msg_erro').text rescue ''
|
55
|
+
invalid_xml_message = response_doc.search("//return").text rescue ''
|
56
56
|
|
57
57
|
raise Models::Errors::UnknownError.new [error_message, invalid_xml_message].join(', ')
|
58
58
|
end
|
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.2.
|
4
|
+
version: 0.2.5
|
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-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|