correios_sigep 1.0.0 → 1.0.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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/correios_sigep.gemspec +1 -1
  4. data/lib/correios_sigep/logistic_reverse/base_client.rb +3 -4
  5. data/lib/correios_sigep/version.rb +1 -1
  6. metadata +4 -90
  7. data/.gitignore +0 -14
  8. data/.rspec +0 -3
  9. data/.rubocop.yml +0 -1160
  10. data/.ruby-gemset +0 -1
  11. data/.ruby-version +0 -1
  12. data/.travis.yml +0 -16
  13. data/Gemfile +0 -8
  14. data/Rakefile +0 -15
  15. data/bin/rake +0 -16
  16. data/spec/correios_sigep/builders/xml/request_collect_number_spec.rb +0 -22
  17. data/spec/correios_sigep/builders/xml/request_spec.rb +0 -34
  18. data/spec/correios_sigep/builders/xml/request_sro_spec.rb +0 -17
  19. data/spec/correios_sigep/configuration_spec.rb +0 -87
  20. data/spec/correios_sigep/logistic_reverse/base_client_spec.rb +0 -93
  21. data/spec/correios_sigep/logistic_reverse/request_collect_number_spec.rb +0 -106
  22. data/spec/correios_sigep/logistic_reverse/request_sro_spec.rb +0 -86
  23. data/spec/correios_sigep/models/collect_spec.rb +0 -149
  24. data/spec/correios_sigep/models/logistic_reverse_spec.rb +0 -221
  25. data/spec/correios_sigep/models/object_spec.rb +0 -53
  26. data/spec/correios_sigep/models/product_spec.rb +0 -37
  27. data/spec/correios_sigep/models/recipient_spec.rb +0 -108
  28. data/spec/correios_sigep/models/sender_spec.rb +0 -141
  29. data/spec/correios_sigep/models/sro_spec.rb +0 -40
  30. data/spec/correios_sigep_spec.rb +0 -27
  31. data/spec/fixtures/builders/logistic_reverse.xml +0 -66
  32. data/spec/fixtures/builders/request_collect_number.xml +0 -64
  33. data/spec/fixtures/builders/request_sro.xml +0 -4
  34. data/spec/fixtures/correios/request_collect_number/response_already_in_use.xml +0 -14
  35. data/spec/fixtures/correios/request_collect_number/response_inexistent_zipcode.xml +0 -14
  36. data/spec/fixtures/correios/request_collect_number/response_not_answered_for_zipcode.xml +0 -14
  37. data/spec/fixtures/correios/request_collect_number/response_not_configured_client.xml +0 -14
  38. data/spec/fixtures/correios/request_collect_number/response_success.xml +0 -27
  39. data/spec/fixtures/correios/request_collect_number/response_unavailable_house_collect.xml +0 -14
  40. data/spec/fixtures/correios/request_collect_number/response_unavailable_service.xml +0 -14
  41. data/spec/fixtures/correios/request_collect_number/response_unexpected.xml +0 -14
  42. data/spec/fixtures/correios/request_sro/response_array_success.xml +0 -38
  43. data/spec/fixtures/correios/request_sro/response_collect_number_not_found.xml +0 -13
  44. data/spec/fixtures/correios/request_sro/response_required_fields.xml +0 -13
  45. data/spec/fixtures/correios/request_sro/response_sro_not_ready.xml +0 -30
  46. data/spec/fixtures/correios/request_sro/response_success.xml +0 -30
  47. data/spec/fixtures/correios/request_sro/response_unknown_error.xml +0 -13
  48. data/spec/fixtures/correios/wsdl.xml +0 -650
  49. data/spec/fixtures/requests/collect_number_request.xml +0 -66
  50. data/spec/fixtures/requests/sro_request.xml +0 -6
  51. data/spec/spec_helper.rb +0 -39
  52. data/spec/support/fixture_helper.rb +0 -13
  53. data/spec/support/logistic_reverse_helper.rb +0 -15
@@ -1,108 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module CorreiosSigep
4
- module Models
5
- describe Recipient do
6
- it { should respond_to :address }
7
- it { should respond_to :area_code }
8
- it { should respond_to :city }
9
- it { should respond_to :complement }
10
- it { should respond_to :email }
11
- it { should respond_to :name }
12
- it { should respond_to :neighborhood }
13
- it { should respond_to :number }
14
- it { should respond_to :phone }
15
- it { should respond_to :postal_code }
16
- it { should respond_to :reference }
17
- it { should respond_to :state }
18
-
19
- describe '#initialize' do
20
- let(:recipient) { described_class.new params }
21
- context 'with address param' do
22
- let(:params) { { address: 'address' } }
23
- it 'set address value' do
24
- expect(recipient.address).to eq 'address'
25
- end
26
- end
27
-
28
- context 'with area code param' do
29
- let(:params) { { area_code: 16 } }
30
- it 'set area code value' do
31
- expect(recipient.area_code).to eq 16
32
- end
33
- end
34
-
35
- context 'with city param' do
36
- let(:params) { { city: 'ARARAQUARA' } }
37
- it 'set city value' do
38
- expect(recipient.city).to eq 'ARARAQUARA'
39
- end
40
- end
41
-
42
- context 'with complement param' do
43
- let(:params) { { complement: 'APTO 101' } }
44
- it 'set complement value' do
45
- expect(recipient.complement).to eq 'APTO 101'
46
- end
47
- end
48
-
49
- context 'with email param' do
50
- let(:params) { { email: 'test@example.com' } }
51
- it 'set email value' do
52
- expect(recipient.email).to eq 'test@example.com'
53
- end
54
- end
55
-
56
- context 'with name param' do
57
- let(:params) { { name: 'TEST' } }
58
- it 'set name value' do
59
- expect(recipient.name).to eq 'TEST'
60
- end
61
- end
62
-
63
- context 'with neighborhood param' do
64
- let(:params) { { neighborhood: 'NEIGHBORHOOD' } }
65
- it 'set neighborhood value' do
66
- expect(recipient.neighborhood).to eq 'NEIGHBORHOOD'
67
- end
68
- end
69
-
70
- context 'with number param' do
71
- let(:params) { { number: 125 } }
72
- it 'set number value' do
73
- expect(recipient.number).to eq 125
74
- end
75
- end
76
-
77
- context 'with phone param' do
78
- let(:params) { { phone: '16123456789'} }
79
- it 'set phone value' do
80
- expect(recipient.phone).to eq '16123456789'
81
- end
82
- end
83
-
84
- context 'with postal code param' do
85
- let(:params) { { postal_code: '14840000'} }
86
- it 'set postal_code value' do
87
- expect(recipient.postal_code).to eq '14840000'
88
- end
89
- end
90
-
91
- context 'with reference param' do
92
- let(:params) { { reference: 'REFERENCE'} }
93
- it 'set reference value' do
94
- expect(recipient.reference).to eq 'REFERENCE'
95
- end
96
- end
97
-
98
- context 'with state param' do
99
- let(:params) { { state: 'SP'} }
100
- it 'set state value' do
101
- expect(recipient.state).to eq 'SP'
102
- end
103
- end
104
-
105
- end
106
- end
107
- end
108
- end
@@ -1,141 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module CorreiosSigep
4
- module Models
5
- describe Sender do
6
- it { should respond_to :address }
7
- it { should respond_to :area_code }
8
- it { should respond_to :city }
9
- it { should respond_to :complement }
10
- it { should respond_to :email }
11
- it { should respond_to :identification }
12
- it { should respond_to :mobile_area_code }
13
- it { should respond_to :mobile_phone }
14
- it { should respond_to :name }
15
- it { should respond_to :neighborhood }
16
- it { should respond_to :number }
17
- it { should respond_to :phone }
18
- it { should respond_to :postal_code }
19
- it { should respond_to :reference }
20
- it { should respond_to :sms }
21
- it { should respond_to :state }
22
-
23
- describe '#initialize' do
24
- let(:sender) { described_class.new params }
25
- context 'with address param' do
26
- let(:params) { { address: 'address' } }
27
- it 'set address value' do
28
- expect(sender.address).to eq 'address'
29
- end
30
- end
31
-
32
- context 'with area code param' do
33
- let(:params) { { area_code: 16 } }
34
- it 'set area code value' do
35
- expect(sender.area_code).to eq 16
36
- end
37
- end
38
-
39
- context 'with city param' do
40
- let(:params) { { city: 'ARARAQUARA' } }
41
- it 'set city value' do
42
- expect(sender.city).to eq 'ARARAQUARA'
43
- end
44
- end
45
-
46
- context 'with complement param' do
47
- let(:params) { { complement: 'APTO 101' } }
48
- it 'set complement value' do
49
- expect(sender.complement).to eq 'APTO 101'
50
- end
51
- end
52
-
53
- context 'with email param' do
54
- let(:params) { { email: 'test@example.com' } }
55
- it 'set email value' do
56
- expect(sender.email).to eq 'test@example.com'
57
- end
58
- end
59
-
60
- context 'with identification param' do
61
- let(:params) { { identification: 'IDENTIFICATION' } }
62
- it 'set identification value' do
63
- expect(sender.identification).to eq 'IDENTIFICATION'
64
- end
65
- end
66
-
67
- context 'with mobile area code param' do
68
- let(:params) { { mobile_area_code: 16 } }
69
- it 'set mobile area code value' do
70
- expect(sender.mobile_area_code).to eq 16
71
- end
72
- end
73
-
74
-
75
- context 'with mobile phone code param' do
76
- let(:params) { { mobile_phone: '16123456789' } }
77
- it 'set mobile area code value' do
78
- expect(sender.mobile_phone).to eq '16123456789'
79
- end
80
- end
81
-
82
- context 'with name param' do
83
- let(:params) { { name: 'TEST' } }
84
- it 'set name value' do
85
- expect(sender.name).to eq 'TEST'
86
- end
87
- end
88
-
89
- context 'with neighborhood param' do
90
- let(:params) { { neighborhood: 'NEIGHBORHOOD' } }
91
- it 'set neighborhood value' do
92
- expect(sender.neighborhood).to eq 'NEIGHBORHOOD'
93
- end
94
- end
95
-
96
- context 'with number param' do
97
- let(:params) { { number: 125 } }
98
- it 'set number value' do
99
- expect(sender.number).to eq 125
100
- end
101
- end
102
-
103
- context 'with phone param' do
104
- let(:params) { { phone: '16123456789'} }
105
- it 'set phone value' do
106
- expect(sender.phone).to eq '16123456789'
107
- end
108
- end
109
-
110
- context 'with postal code param' do
111
- let(:params) { { postal_code: '14840000'} }
112
- it 'set postal_code value' do
113
- expect(sender.postal_code).to eq '14840000'
114
- end
115
- end
116
-
117
- context 'with reference param' do
118
- let(:params) { { reference: 'REFERENCE'} }
119
- it 'set reference value' do
120
- expect(sender.reference).to eq 'REFERENCE'
121
- end
122
- end
123
-
124
- context 'with sms param' do
125
- let(:params) { { sms: 'S'} }
126
- it 'set sms value' do
127
- expect(sender.sms).to eq 'S'
128
- end
129
- end
130
-
131
- context 'with state param' do
132
- let(:params) { { state: 'SP'} }
133
- it 'set state value' do
134
- expect(sender.state).to eq 'SP'
135
- end
136
- end
137
-
138
- end
139
- end
140
- end
141
- end
@@ -1,40 +0,0 @@
1
- module CorreiosSigep
2
- module Models
3
- describe SRO do
4
- it { should respond_to :collect_number }
5
- it { should respond_to :type }
6
-
7
- describe '.initialize' do
8
- subject { described_class.new params }
9
-
10
- context 'with nil params' do
11
- let(:params) { Hash.new }
12
-
13
- it 'binds attrs to nil' do
14
- expect(subject.collect_number).to be_nil
15
- expect(subject.type).to be_nil
16
- end
17
- end
18
-
19
- context 'with present params' do
20
- let(:params) { { collect_number: '1234', type: 'A' } }
21
- it 'binds params to params' do
22
- expect(subject.collect_number).to eq params[:collect_number]
23
- expect(subject.type).to eq params[:type]
24
- end
25
- end
26
- end
27
-
28
- describe '.to_xml' do
29
- let(:sro) { described_class.new(collect_number: '12345', type: 'A') }
30
- let(:xml) do
31
- "<?xml version=\"1.0\"?>\n<root>\n <tipoBusca>H</tipoBusca>\n <tipoSolicitacao>A</tipoSolicitacao>\n <numeroPedido>12345</numeroPedido>\n</root>\n"
32
- end
33
-
34
- it 'generates the correct xml with root' do
35
- expect(sro.to_xml).to eq xml
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe CorreiosSigep do
4
- describe '#configure' do
5
- subject { described_class.configuration }
6
- before do
7
- described_class.configure do |config|
8
- config.administrative_code = '08082650'
9
- config.card = '0057018901'
10
- config.service_code = '41076'
11
- end
12
- end
13
-
14
- it 'configures the correct administrative code' do
15
- expect(subject.administrative_code).to eq '08082650'
16
- end
17
-
18
- it 'configures the correct card' do
19
- expect(subject.card).to eq '0057018901'
20
- end
21
-
22
- it 'configures the correct service_code' do
23
- expect(subject.service_code).to eq '41076'
24
- end
25
-
26
- end
27
- end
@@ -1,66 +0,0 @@
1
- <?xml version="1.0"?>
2
- <root>
3
- <destinatario>
4
- <nome>ESTABELECIMENT W*M</nome>
5
- <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>
6
- <numero>1400</numero>
7
- <complemento>G4</complemento>
8
- <bairro>FAZENDA ITAQUI</bairro>
9
- <referencia>REFERENCE</referencia>
10
- <cidade>BARUERI</cidade>
11
- <uf>SP</uf>
12
- <cep>06442130</cep>
13
- <ddd>11</ddd>
14
- <telefone>21683228</telefone>
15
- <email>teste@example.com</email>
16
- </destinatario>
17
- <coletas_solicitadas>
18
- <tipo>CA</tipo>
19
- <id_cliente>1405670</id_cliente>
20
- <valor_declarado>100.5</valor_declarado>
21
- <descricao>teste</descricao>
22
- <cklist>cklist</cklist>
23
- <numero>1</numero>
24
- <ag>1</ag>
25
- <cartao>1234</cartao>
26
- <servico_adicional>20.5</servico_adicional>
27
- <ar>2</ar>
28
- <remetente>
29
- <nome>JEFERSON VAZ DOS SANTOS</nome>
30
- <logradouro>RUA BLA BLA BLA</logradouro>
31
- <numero>666</numero>
32
- <complemento>APT 100</complemento>
33
- <bairro>PINHEIROS</bairro>
34
- <referencia>REFERENCE</referencia>
35
- <cidade>S&#xC3;O PAULO</cidade>
36
- <uf>SP</uf>
37
- <cep>05427020</cep>
38
- <ddd>16</ddd>
39
- <telefone>41606809</telefone>
40
- <email>jeff@example.com</email>
41
- <identificacao/>
42
- <ddd_celular/>
43
- <celular/>
44
- <sms/>
45
- </remetente>
46
- <produto>
47
- <codigo>code</codigo>
48
- <tipo>type</tipo>
49
- <qtd>3</qtd>
50
- </produto>
51
- <obj_col>
52
- <item>127078</item>
53
- <id>1405670</id>
54
- <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>
55
- <entrega>ship</entrega>
56
- <num>1</num>
57
- </obj_col>
58
- <obj_col>
59
- <item>277574</item>
60
- <id>1405670</id>
61
- <desc>Chip unico claro Pre pago</desc>
62
- <entrega>ship</entrega>
63
- <num>2</num>
64
- </obj_col>
65
- </coletas_solicitadas>
66
- </root>
@@ -1,64 +0,0 @@
1
- <cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><codAdministrativo>08082650</codAdministrativo>
2
- <destinatario>
3
- <nome>ESTABELECIMENT W*M</nome>
4
- <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>
5
- <numero>1400</numero>
6
- <complemento>G4</complemento>
7
- <bairro>FAZENDA ITAQUI</bairro>
8
- <referencia>REFERENCE</referencia>
9
- <cidade>BARUERI</cidade>
10
- <uf>SP</uf>
11
- <cep>06442130</cep>
12
- <ddd>11</ddd>
13
- <telefone>21683228</telefone>
14
- <email>teste@example.com</email>
15
- </destinatario>
16
- <coletas_solicitadas>
17
- <tipo>CA</tipo>
18
- <id_cliente>1405670</id_cliente>
19
- <valor_declarado>100.5</valor_declarado>
20
- <descricao>teste</descricao>
21
- <cklist>cklist</cklist>
22
- <numero>1</numero>
23
- <ag>1</ag>
24
- <cartao>1234</cartao>
25
- <servico_adicional>20.5</servico_adicional>
26
- <ar>2</ar>
27
- <remetente>
28
- <nome>JEFERSON VAZ DOS SANTOS</nome>
29
- <logradouro>RUA BLA BLA BLA</logradouro>
30
- <numero>666</numero>
31
- <complemento>APT 100</complemento>
32
- <bairro>PINHEIROS</bairro>
33
- <referencia>REFERENCE</referencia>
34
- <cidade>S&#xC3;O PAULO</cidade>
35
- <uf>SP</uf>
36
- <cep>05427020</cep>
37
- <ddd>16</ddd>
38
- <telefone>41606809</telefone>
39
- <email>jeff@example.com</email>
40
- <identificacao/>
41
- <ddd_celular/>
42
- <celular/>
43
- <sms/>
44
- </remetente>
45
- <produto>
46
- <codigo>code</codigo>
47
- <tipo>type</tipo>
48
- <qtd>3</qtd>
49
- </produto>
50
- <obj_col>
51
- <item>127078</item>
52
- <id>1405670</id>
53
- <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>
54
- <entrega>ship</entrega>
55
- <num>1</num>
56
- </obj_col>
57
- <obj_col>
58
- <item>277574</item>
59
- <id>1405670</id>
60
- <desc>Chip unico claro Pre pago</desc>
61
- <entrega>ship</entrega>
62
- <num>2</num>
63
- </obj_col>
64
- </coletas_solicitadas>