correios_sigep 0.2.2 → 0.2.3
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/lib/correios_sigep/builders/xml/collect.rb +1 -4
- data/lib/correios_sigep/builders/xml/collect_objects.rb +10 -6
- data/lib/correios_sigep/version.rb +1 -1
- data/spec/correios_sigep/logistic_reverse/request_collect_number_spec.rb +31 -43
- data/spec/correios_sigep/models/logistic_reverse_spec.rb +7 -9
- data/spec/fixtures/builders/logistic_reverse.xml +66 -0
- data/spec/fixtures/builders/request_collect_number.xml +12 -14
- data/spec/fixtures/requests/collect_number_request.xml +66 -0
- data/spec/support/fixture_helper.rb +4 -0
- metadata +6 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                MDg4MzVhMjBkNmM4ZGZjODUyZGY0YWQ2ZTJkNGFlZTk1MjkxZGVmMA==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                YWEzYjMxNzFlNWEyMzRhNjM3NjEzMTVlYTgwYjYxZDNmMjkwYzcxYQ==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NDJjNWRiY2JhZTNjNWY4OGRiZDFiOWZiMzUzODBkNmI0ZjUxZGZjOTk0MzNh
         | 
| 10 | 
            +
                MDQzNzBlMGE0NjRmOWZkZjZhNjZhNTE0MjA1YmQ2YzEzZWUzZTZkNjlhZTUy
         | 
| 11 | 
            +
                Y2ZkNTcwNDQzNTk3NWRhZjRkYTVkODgyNTllZDQ3ZWMzYWZiNzY=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ZWIzYjdjNjJkMWY5NmE3NzJlNmNjN2Y1MTAyNTAyMWJkYzY0OTNjYWRjNGYx
         | 
| 14 | 
            +
                ZDljOWFjNzJkMTBjNGY0NDYyMTE1YjUzN2U3OGI0ZWU5YTRiZjVkYzVhMjRi
         | 
| 15 | 
            +
                ZWE2MTdlNzJiOWY1ZDM3MGEyNWI0NGM1MmZkNWIxNDBiYmFlZjM=
         | 
| @@ -21,12 +21,9 @@ module CorreiosSigep | |
| 21 21 | 
             
                        @builder.ar                @collect.ar
         | 
| 22 22 | 
             
                        XML::Sender.new(@builder, @collect.sender).build_xml
         | 
| 23 23 | 
             
                        XML::Product.new(@builder, @collect.product).build_xml
         | 
| 24 | 
            -
                        @builder. | 
| 25 | 
            -
                          XML::CollectObjects.new(@builder, @collect.objects).build_xml
         | 
| 26 | 
            -
                        end
         | 
| 24 | 
            +
                        XML::CollectObjects.new(@builder, @collect.objects).build_xml
         | 
| 27 25 | 
             
                      end
         | 
| 28 26 | 
             
                    end
         | 
| 29 | 
            -
             | 
| 30 27 | 
             
                  end
         | 
| 31 28 | 
             
                end
         | 
| 32 29 | 
             
              end
         | 
| @@ -9,16 +9,20 @@ module CorreiosSigep | |
| 9 9 |  | 
| 10 10 | 
             
                    def build_xml
         | 
| 11 11 | 
             
                      @objects.each do |object|
         | 
| 12 | 
            -
                        @builder. | 
| 13 | 
            -
                           | 
| 14 | 
            -
                          @builder.id    object.id
         | 
| 15 | 
            -
                          @builder.desc  object.description
         | 
| 16 | 
            -
                          @builder.ship  object.ship
         | 
| 17 | 
            -
                          @builder.num   object.num
         | 
| 12 | 
            +
                        @builder.obj_col do
         | 
| 13 | 
            +
                          build_item(object)
         | 
| 18 14 | 
             
                        end
         | 
| 19 15 | 
             
                      end
         | 
| 20 16 | 
             
                    end
         | 
| 21 17 |  | 
| 18 | 
            +
                    private
         | 
| 19 | 
            +
                    def build_item(object)
         | 
| 20 | 
            +
                      @builder.item  object.item
         | 
| 21 | 
            +
                      @builder.id    object.id
         | 
| 22 | 
            +
                      @builder.desc  object.description
         | 
| 23 | 
            +
                      @builder.ship  object.ship
         | 
| 24 | 
            +
                      @builder.num   object.num
         | 
| 25 | 
            +
                    end
         | 
| 22 26 | 
             
                  end
         | 
| 23 27 | 
             
                end
         | 
| 24 28 | 
             
              end
         | 
| @@ -4,104 +4,92 @@ module CorreiosSigep | |
| 4 4 | 
             
              module LogisticReverse
         | 
| 5 5 | 
             
                describe RequestCollectNumber do
         | 
| 6 6 | 
             
                  let(:logistic_reverse) { Models::LogisticReverse.new }
         | 
| 7 | 
            -
                  let(:request_collect) | 
| 7 | 
            +
                  let(:request_collect)  { described_class.new logistic_reverse }
         | 
| 8 | 
            +
                  let(:body)             { request_fixture('collect_number_request.xml') }
         | 
| 9 | 
            +
                  let(:request_header)   { request_fixture('header.txt') }
         | 
| 8 10 |  | 
| 9 11 | 
             
                  before do
         | 
| 10 12 | 
             
                    seed_logistic_reverse(logistic_reverse)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    # WSDL
         | 
| 11 15 | 
             
                    stub_request(:get, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol?wsdl").
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 16 | 
            +
                      with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
         | 
| 17 | 
            +
                      to_return(:status => 200, :body => correios_fixture('wsdl.xml'), :headers => {})
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    # REQUEST
         | 
| 20 | 
            +
                    stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 21 | 
            +
                     with(:body => body, :headers => { 'Accept'=>'*/*',
         | 
| 22 | 
            +
                        'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
         | 
| 23 | 
            +
                        'Content-Length'=>'2267', 'Content-Type'=>'text/xml;charset=UTF-8',
         | 
| 24 | 
            +
                        'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby' }).
         | 
| 25 | 
            +
                     to_return(:status => 200, :body => correios_fixture(response_body), :headers => {})
         | 
| 14 26 | 
             
                  end
         | 
| 15 27 |  | 
| 16 28 | 
             
                  describe '.process' do
         | 
| 17 29 | 
             
                    subject { request_collect.process }
         | 
| 18 30 |  | 
| 19 31 | 
             
                    context 'with success response' do
         | 
| 20 | 
            -
                       | 
| 21 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 22 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 23 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 24 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_success.xml'), :headers => {})
         | 
| 32 | 
            +
                      let(:response_body) { 'response_success.xml' }
         | 
| 25 33 |  | 
| 34 | 
            +
                      it 'returns the collect number' do
         | 
| 26 35 | 
             
                        expect(subject).to eq '373533437'
         | 
| 27 36 | 
             
                      end
         | 
| 28 37 | 
             
                    end
         | 
| 29 38 |  | 
| 30 39 | 
             
                    context 'with ticket already in use' do
         | 
| 31 | 
            -
                       | 
| 32 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 33 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 34 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 35 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_already_in_use.xml'), :headers => {})
         | 
| 40 | 
            +
                      let(:response_body) { 'response_already_in_use.xml' }
         | 
| 36 41 |  | 
| 42 | 
            +
                      it 'raises TicketAlreadyUsed error' do
         | 
| 37 43 | 
             
                        expect{subject}.to raise_error(Models::Errors::TicketAlreadyUsed)
         | 
| 38 44 | 
             
                      end
         | 
| 39 45 | 
             
                    end
         | 
| 40 46 |  | 
| 41 47 | 
             
                    context 'when service is unavailable' do
         | 
| 42 | 
            -
                       | 
| 43 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 44 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 45 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 46 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_unavailable_service.xml'), :headers => {})
         | 
| 48 | 
            +
                      let(:response_body) { 'response_unavailable_service.xml' }
         | 
| 47 49 |  | 
| 50 | 
            +
                      it 'raises UnvailableService error' do
         | 
| 48 51 | 
             
                        expect{subject}.to raise_error(Models::Errors::UnavailableService)
         | 
| 49 52 | 
             
                      end
         | 
| 50 53 | 
             
                    end
         | 
| 51 54 |  | 
| 52 55 | 
             
                    context 'when zipcode not exist' do
         | 
| 53 | 
            -
                       | 
| 54 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 55 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 56 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 57 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_inexistent_zipcode.xml'), :headers => {})
         | 
| 56 | 
            +
                      let(:response_body) { 'response_inexistent_zipcode.xml' }
         | 
| 58 57 |  | 
| 58 | 
            +
                      it 'raises InexistentZipcode error' do
         | 
| 59 59 | 
             
                        expect{subject}.to raise_error(Models::Errors::InexistentZipcode)
         | 
| 60 60 | 
             
                      end
         | 
| 61 61 | 
             
                    end
         | 
| 62 62 |  | 
| 63 63 | 
             
                    context 'when collect is not available for the house' do
         | 
| 64 | 
            -
                       | 
| 65 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 66 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 67 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 68 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_unavailable_house_collect.xml'), :headers => {})
         | 
| 64 | 
            +
                      let(:response_body) { 'response_unavailable_house_collect.xml' }
         | 
| 69 65 |  | 
| 66 | 
            +
                      it 'raises UnavailableHouseCollect error' do
         | 
| 70 67 | 
             
                        expect{subject}.to raise_error(Models::Errors::UnavailableHouseCollect)
         | 
| 71 68 | 
             
                      end
         | 
| 72 69 | 
             
                    end
         | 
| 73 70 |  | 
| 74 71 |  | 
| 75 72 | 
             
                    context 'when collect is for a not answered zipcode' do
         | 
| 76 | 
            -
                       | 
| 77 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 78 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 79 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 80 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_not_answered_for_zipcode.xml'), :headers => {})
         | 
| 73 | 
            +
                      let(:response_body) { 'response_not_answered_for_zipcode.xml' }
         | 
| 81 74 |  | 
| 75 | 
            +
                      it 'raises CollectNotAnsweredForTheZipcode error' do
         | 
| 82 76 | 
             
                        expect{subject}.to raise_error(Models::Errors::CollectNotAnsweredForTheZipcode)
         | 
| 83 77 | 
             
                      end
         | 
| 84 78 | 
             
                    end
         | 
| 85 79 |  | 
| 86 80 | 
             
                    context 'when user is not configured to use sigepweb' do
         | 
| 87 | 
            -
                       | 
| 88 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 89 | 
            -
                                   with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 90 | 
            -
                                                     :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 91 | 
            -
                                   to_return(:status => 200, :body => correios_fixture('response_not_configured_client.xml'), :headers => {})
         | 
| 81 | 
            +
                      let(:response_body) { 'response_not_configured_client.xml' }
         | 
| 92 82 |  | 
| 83 | 
            +
                      it 'raises NotConfiguredClient error' do
         | 
| 93 84 | 
             
                        expect{subject}.to raise_error(Models::Errors::NotConfiguredClient)
         | 
| 94 85 | 
             
                      end
         | 
| 95 86 | 
             
                    end
         | 
| 96 87 |  | 
| 97 88 |  | 
| 98 89 | 
             
                    context 'when correios answer with another code' do
         | 
| 99 | 
            -
                       | 
| 100 | 
            -
                        stub_request(:post, "http://webservicescolhomologacao.correios.com.br/ScolWeb/WebServiceScol").
         | 
| 101 | 
            -
                     with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:tns=\"http://webservice.scol.correios.com.br/\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>\n  <destinatario>\n    <nome>ESTABELECIMENT W*M</nome>\n    <logradouro>ESTRADA DE ACESSO A JANDIRA</logradouro>\n    <numero>1400</numero>\n    <complemento>G4</complemento>\n    <bairro>FAZENDA ITAQUI</bairro>\n    <referencia>REFERENCE</referencia>\n    <cidade>BARUERI</cidade>\n    <uf>SP</uf>\n    <cep>06442130</cep>\n    <ddd>11</ddd>\n    <telefone>21683228</telefone>\n    <email>teste@example.com</email>\n  </destinatario>\n  <coletas_solicitadas>\n    <tipo>CA</tipo>\n    <id_cliente>1405670</id_cliente>\n    <valor_declarado>100.5</valor_declarado>\n    <descricao>teste</descricao>\n    <cklist>cklist</cklist>\n    <numero>1</numero>\n    <ag>1</ag>\n    <cartao>1234</cartao>\n    <servico_adicional>20.5</servico_adicional>\n    <ar>2</ar>\n    <remetente>\n      <nome>JEFERSON VAZ DOS SANTOS</nome>\n      <logradouro>RUA BLA BLA BLA</logradouro>\n      <numero>666</numero>\n      <complemento>APT 100</complemento>\n      <bairro>PINHEIROS</bairro>\n      <referencia>REFERENCE</referencia>\n      <cidade>SÃO PAULO</cidade>\n      <uf>SP</uf>\n      <cep>05427020</cep>\n      <ddd>16</ddd>\n      <telefone>41606809</telefone>\n      <email>jeff@example.com</email>\n      <identificacao/>\n      <ddd_celular/>\n      <celular/>\n      <sms/>\n    </remetente>\n    <produto>\n      <codigo>code</codigo>\n      <tipo>type</tipo>\n      <qtd>3</qtd>\n    </produto>\n    <obj_col>\n      <obj>\n        <item>127078</item>\n        <id>1405670</id>\n        <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>\n        <ship>ship</ship>\n        <num>1</num>\n      </obj>\n      <obj>\n        <item>277574</item>\n        <id>1405670</id>\n        <desc>Chip unico claro Pre pago</desc>\n        <ship>ship</ship>\n        <num>2</num>\n      </obj>\n    </obj_col>\n  </coletas_solicitadas>\n\n</tns:solicitarPostagemReversa></env:Body></env:Envelope>",
         | 
| 102 | 
            -
                          :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'2308', 'Content-Type'=>'text/xml;charset=UTF-8', 'Soapaction'=>'"solicitarPostagemReversa"', 'User-Agent'=>'Ruby'}).
         | 
| 103 | 
            -
                     to_return(:status => 200, :body => correios_fixture('response_unexpected.xml'), :headers => {})
         | 
| 90 | 
            +
                      let(:response_body) { 'response_unexpected.xml' }
         | 
| 104 91 |  | 
| 92 | 
            +
                      it 'raises UnknownError error' do
         | 
| 105 93 | 
             
                        expect{subject}.to raise_error(Models::Errors::UnknownError)
         | 
| 106 94 | 
             
                      end
         | 
| 107 95 | 
             
                    end
         | 
| @@ -11,14 +11,14 @@ module CorreiosSigep | |
| 11 11 | 
             
                      context 'present' do
         | 
| 12 12 | 
             
                        let(:collect) { double(:collect) }
         | 
| 13 13 | 
             
                        let(:params) { { collect: collect } }
         | 
| 14 | 
            -
                        it ' | 
| 14 | 
            +
                        it 'sets collect value as the same in the param' do
         | 
| 15 15 | 
             
                          expect(logistic_reverse.collect).to eq collect
         | 
| 16 16 | 
             
                        end
         | 
| 17 17 | 
             
                      end
         | 
| 18 18 |  | 
| 19 19 | 
             
                      context 'not present' do
         | 
| 20 20 | 
             
                        let(:params) { {} }
         | 
| 21 | 
            -
                        it ' | 
| 21 | 
            +
                        it 'sets collect as a new Collect model' do
         | 
| 22 22 | 
             
                          expect(Models::Collect).to receive(:new).and_call_original
         | 
| 23 23 | 
             
                          expect(logistic_reverse.collect).to be_a(Models::Collect)
         | 
| 24 24 | 
             
                        end
         | 
| @@ -37,7 +37,7 @@ module CorreiosSigep | |
| 37 37 |  | 
| 38 38 | 
             
                      context 'not present' do
         | 
| 39 39 | 
             
                        let(:params) { {} }
         | 
| 40 | 
            -
                        it ' | 
| 40 | 
            +
                        it 'sets recipient as a new Recipient model' do
         | 
| 41 41 | 
             
                          expect(Models::Recipient).to receive(:new).and_call_original
         | 
| 42 42 | 
             
                          expect(logistic_reverse.recipient).to be_a(Models::Recipient)
         | 
| 43 43 | 
             
                        end
         | 
| @@ -48,13 +48,11 @@ module CorreiosSigep | |
| 48 48 |  | 
| 49 49 | 
             
                  describe '#to_xml' do
         | 
| 50 50 | 
             
                    let(:logistic_reverse) { described_class.new }
         | 
| 51 | 
            -
                     | 
| 52 | 
            -
             | 
| 53 | 
            -
                    end
         | 
| 51 | 
            +
                    let(:expected_xml)     { builders_fixture('logistic_reverse.xml') }
         | 
| 52 | 
            +
                    before { seed_logistic_reverse(logistic_reverse) }
         | 
| 54 53 |  | 
| 55 | 
            -
                    it ' | 
| 56 | 
            -
                       | 
| 57 | 
            -
                      expect(logistic_reverse.to_xml).to eq expected_xml
         | 
| 54 | 
            +
                    it 'generates the correct XMl of the logistic_reverse' do
         | 
| 55 | 
            +
                      expect(logistic_reverse.to_xml).to match expected_xml
         | 
| 58 56 | 
             
                    end
         | 
| 59 57 | 
             
                  end
         | 
| 60 58 | 
             
                end
         | 
| @@ -0,0 +1,66 @@ | |
| 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Ã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 | 
            +
                  <ship>ship</ship>
         | 
| 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 | 
            +
                  <ship>ship</ship>
         | 
| 63 | 
            +
                  <num>2</num>
         | 
| 64 | 
            +
                </obj_col>
         | 
| 65 | 
            +
              </coletas_solicitadas>
         | 
| 66 | 
            +
            </root>
         | 
| @@ -48,20 +48,18 @@ | |
| 48 48 | 
             
                  <qtd>3</qtd>
         | 
| 49 49 | 
             
                </produto>
         | 
| 50 50 | 
             
                <obj_col>
         | 
| 51 | 
            -
                  < | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
                  < | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
                    <num>2</num>
         | 
| 64 | 
            -
                  </obj>
         | 
| 51 | 
            +
                  <item>127078</item>
         | 
| 52 | 
            +
                  <id>1405670</id>
         | 
| 53 | 
            +
                  <desc>Pen Drive SAndisk 16GB SDCZ50-016G-A95</desc>
         | 
| 54 | 
            +
                  <ship>ship</ship>
         | 
| 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 | 
            +
                  <ship>ship</ship>
         | 
| 62 | 
            +
                  <num>2</num>
         | 
| 65 63 | 
             
                </obj_col>
         | 
| 66 64 | 
             
              </coletas_solicitadas>
         | 
| 67 65 |  | 
| @@ -0,0 +1,66 @@ | |
| 1 | 
            +
            <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://webservice.scol.correios.com.br/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:solicitarPostagemReversa><cartao>0057018901</cartao><codigo_servico>41076</codigo_servico><contrato>9912208555</contrato><codAdministrativo>08082650</codAdministrativo><senha>8o8otn</senha><usuario>60618043</usuario>
         | 
| 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Ã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 | 
            +
                  <ship>ship</ship>
         | 
| 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 | 
            +
                  <ship>ship</ship>
         | 
| 62 | 
            +
                  <num>2</num>
         | 
| 63 | 
            +
                </obj_col>
         | 
| 64 | 
            +
              </coletas_solicitadas>
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            </tns:solicitarPostagemReversa></env:Body></env: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.2. | 
| 4 | 
            +
              version: 0.2.3
         | 
| 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-07-01 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: savon
         | 
| @@ -164,6 +164,7 @@ files: | |
| 164 164 | 
             
            - spec/correios_sigep/models/sender_spec.rb
         | 
| 165 165 | 
             
            - spec/correios_sigep/models/sro_spec.rb
         | 
| 166 166 | 
             
            - spec/correios_sigep_spec.rb
         | 
| 167 | 
            +
            - spec/fixtures/builders/logistic_reverse.xml
         | 
| 167 168 | 
             
            - spec/fixtures/builders/request_collect_number.xml
         | 
| 168 169 | 
             
            - spec/fixtures/builders/request_sro.xml
         | 
| 169 170 | 
             
            - spec/fixtures/correios/response_already_in_use.xml
         | 
| @@ -175,6 +176,7 @@ files: | |
| 175 176 | 
             
            - spec/fixtures/correios/response_unavailable_service.xml
         | 
| 176 177 | 
             
            - spec/fixtures/correios/response_unexpected.xml
         | 
| 177 178 | 
             
            - spec/fixtures/correios/wsdl.xml
         | 
| 179 | 
            +
            - spec/fixtures/requests/collect_number_request.xml
         | 
| 178 180 | 
             
            - spec/spec_helper.rb
         | 
| 179 181 | 
             
            - spec/support/fixture_helper.rb
         | 
| 180 182 | 
             
            - spec/support/logistic_reverse_helper.rb
         | 
| @@ -218,6 +220,7 @@ test_files: | |
| 218 220 | 
             
            - spec/correios_sigep/models/sender_spec.rb
         | 
| 219 221 | 
             
            - spec/correios_sigep/models/sro_spec.rb
         | 
| 220 222 | 
             
            - spec/correios_sigep_spec.rb
         | 
| 223 | 
            +
            - spec/fixtures/builders/logistic_reverse.xml
         | 
| 221 224 | 
             
            - spec/fixtures/builders/request_collect_number.xml
         | 
| 222 225 | 
             
            - spec/fixtures/builders/request_sro.xml
         | 
| 223 226 | 
             
            - spec/fixtures/correios/response_already_in_use.xml
         | 
| @@ -229,6 +232,7 @@ test_files: | |
| 229 232 | 
             
            - spec/fixtures/correios/response_unavailable_service.xml
         | 
| 230 233 | 
             
            - spec/fixtures/correios/response_unexpected.xml
         | 
| 231 234 | 
             
            - spec/fixtures/correios/wsdl.xml
         | 
| 235 | 
            +
            - spec/fixtures/requests/collect_number_request.xml
         | 
| 232 236 | 
             
            - spec/spec_helper.rb
         | 
| 233 237 | 
             
            - spec/support/fixture_helper.rb
         | 
| 234 238 | 
             
            - spec/support/logistic_reverse_helper.rb
         |