correios-cep 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +6 -0
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +13 -4
- data/correios-cep.gemspec +3 -2
- data/lib/correios/cep/version.rb +1 -1
- data/lib/correios/cep/web_service.rb +2 -2
- data/spec/fixtures/cassettes/correios_consulta_cep_ok.yml +18 -23
- data/spec/spec_helper.rb +4 -1
- metadata +37 -22
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NmM5MGQ4OTVlNGM3OGJhYzU2ZTdkNGE5ZmE2Y2JmZjBhOWQ1YzA0MWRjNzNk
|
10
|
-
NzNmY2ZmZDI2YjI1NGYwNmYxOGZlNDNmM2UxNzAyMzZjZDU0ZmYxMDkyMjcy
|
11
|
-
MTE3NzExOGExODVmOWMxZGE3NzUyNjU2ZDkyMmUwNDBlMDlmOGQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZGQ5YmVkMTQ5ZTkyMGQxNTE0ODc0MDE3NGYwZTU0OWYzMDgzNTdlZWQ4NDkz
|
14
|
-
ZGI1N2M5MTMwNDk3NjQ2ODRkNGE4ZWE1ZTNmNWRhNjFiOTY1YWFkYjFmMDNm
|
15
|
-
YjJjMGU0MmY3ZmJlMzBmZjA3YmJlMTJhYzRhMzI5NzhhMzI1ZWU=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ae3e3f91d0821fdda221d34602c6c5f0e75485f
|
4
|
+
data.tar.gz: 225d47253b5261291a661de99cb674a77a94d8f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45ebcf3af3a53a45ececea956e457c74293bceafd23955224356c359f601a35baf13141a4b63b77b66cb361b7f4ba888ef066e441a5707b3c263e7fb841c9f04
|
7
|
+
data.tar.gz: 0db954b8d1712e573139c2a147b8df9cea9bef7db0b9d1b2d66edae70359caa21c6d1def4b2b65cd2feb8896f7773eb7d5ba54df6a5d775ae991074edc856e02
|
data/.travis.yml
ADDED
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
= correios-cep
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
Current available solutions to find Brazilian addresses by zipcode use an HTML form from Correios web site to perform it, instead of to use a real API.
|
4
|
+
|
5
|
+
That workaround works with an HTTP request to the form, followed by parsing the HTML result page. The huge problem here is when the Correios web site development team decides to modify some HTML element in the result page, even a layout update, it will break the parser logic for result.
|
6
|
+
|
7
|
+
Correios CEP gem solves this problem, getting data directly from Correios database. No HTML parsers, no workarounds, no "gambis".
|
5
8
|
|
6
9
|
http://prodis.net.br/images/ruby/2011/correios_logo.png
|
7
10
|
|
11
|
+
{<img src="https://badge.fury.io/rb/correios-cep.png" alt="Gem Version" />}[http://badge.fury.io/rb/correios-cep]
|
12
|
+
{<img src="https://travis-ci.org/prodis/correios-cep.png?branch=master" alt="Build Status" />}[https://travis-ci.org/prodis/correios-cep]
|
13
|
+
{<img src="https://coveralls.io/repos/prodis/correios-cep/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/prodis/correios-cep]
|
14
|
+
{<img src="https://codeclimate.com/github/prodis/correios-cep.png" alt="Code Climate" />}[https://codeclimate.com/github/prodis/correios-cep]
|
15
|
+
{<img src="https://gemnasium.com/prodis/correios-cep.png" alt="Dependency Status" />}[https://gemnasium.com/prodis/correios-cep]
|
16
|
+
|
8
17
|
|
9
18
|
== Installing
|
10
19
|
|
@@ -53,7 +62,7 @@ You can configure this timeout using <b>Correios::CEP</b> module.
|
|
53
62
|
For default, each request to Correios Web service is logged to STDOUT, with <b>:info</b> log level, using the gem {LogMe}[http://github.com/prodis/log-me].
|
54
63
|
|
55
64
|
Log example:
|
56
|
-
I, [2014-02-14T00:10:12.718413 #76361] INFO -- : Correios
|
65
|
+
I, [2014-02-14T00:10:12.718413 #76361] INFO -- : [Correios::CEP] Request:
|
57
66
|
POST http://200.252.60.209/SigepCliente/AtendeClienteService
|
58
67
|
<?xml version="1.0" encoding="UTF-8"?>
|
59
68
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/">
|
@@ -65,7 +74,7 @@ Log example:
|
|
65
74
|
</soapenv:Body>
|
66
75
|
</soapenv:Envelope>
|
67
76
|
|
68
|
-
I, [2014-02-14T00:10:12.969937 #76361] INFO -- : Correios
|
77
|
+
I, [2014-02-14T00:10:12.969937 #76361] INFO -- : [Correios::CEP] Response:
|
69
78
|
HTTP/1.1 200 OK
|
70
79
|
<?xml version='1.0' encoding='UTF-8'?>
|
71
80
|
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
|
data/correios-cep.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["prodis@gmail.com"]
|
10
10
|
spec.description = %q{Correios CEP gem gets updated Brazilian address from a zipcode, directly from Correios database. No HTML parsers, no workarounds, no "gambis".}
|
11
11
|
spec.summary = spec.description
|
12
|
-
spec.homepage = "
|
12
|
+
spec.homepage = "http://prodis.blog.br/correios-cep-gem-para-consulta-de-enderecos-por-cep"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files`.split($/)
|
@@ -20,9 +20,10 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.platform = Gem::Platform::RUBY
|
21
21
|
spec.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
|
22
22
|
|
23
|
-
spec.add_dependency "log-me", "
|
23
|
+
spec.add_dependency "log-me", "= 0.0.5"
|
24
24
|
spec.add_dependency "nokogiri", "~> 1.6"
|
25
25
|
|
26
|
+
spec.add_development_dependency "coveralls"
|
26
27
|
spec.add_development_dependency "rake"
|
27
28
|
spec.add_development_dependency "rspec", "~> 2.14"
|
28
29
|
spec.add_development_dependency "vcr", "~> 2.8"
|
data/lib/correios/cep/version.rb
CHANGED
@@ -51,7 +51,7 @@ module Correios
|
|
51
51
|
|
52
52
|
def log_request(request)
|
53
53
|
message = format_message(request) do
|
54
|
-
message = with_line_break { "
|
54
|
+
message = with_line_break { "Request:" }
|
55
55
|
message << with_line_break { "POST #{URL}" }
|
56
56
|
end
|
57
57
|
|
@@ -60,7 +60,7 @@ module Correios
|
|
60
60
|
|
61
61
|
def log_response(response)
|
62
62
|
message = format_message(response) do
|
63
|
-
message = with_line_break { "
|
63
|
+
message = with_line_break { "Response:" }
|
64
64
|
message << with_line_break { "HTTP/#{response.http_version} #{response.code} #{response.message}" }
|
65
65
|
end
|
66
66
|
|
@@ -4,13 +4,15 @@ http_interactions:
|
|
4
4
|
method: post
|
5
5
|
uri: http://200.252.60.209/SigepCliente/AtendeClienteService
|
6
6
|
body:
|
7
|
-
encoding:
|
7
|
+
encoding: UTF-8
|
8
8
|
string: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
|
9
9
|
xmlns:cli="http://cliente.bean.master.sigep.bsb.correios.com.br/"><soapenv:Header
|
10
10
|
/><soapenv:Body><cli:consultaCEP><cep>54250610</cep></cli:consultaCEP></soapenv:Body></soapenv:Envelope>
|
11
11
|
headers:
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|
13
|
-
-
|
15
|
+
- '*/*'
|
14
16
|
User-Agent:
|
15
17
|
- Ruby
|
16
18
|
Content-Type:
|
@@ -18,27 +20,20 @@ http_interactions:
|
|
18
20
|
response:
|
19
21
|
status:
|
20
22
|
code: 200
|
21
|
-
message:
|
22
|
-
T0s=
|
23
|
+
message: OK
|
23
24
|
headers:
|
24
|
-
|
25
|
-
-
|
26
|
-
|
27
|
-
|
28
|
-
-
|
29
|
-
|
30
|
-
|
31
|
-
-
|
32
|
-
|
33
|
-
|
34
|
-
-
|
35
|
-
|
36
|
-
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
37
|
-
- !binary |-
|
38
|
-
Y2h1bmtlZA==
|
39
|
-
!binary "Q29udGVudC1UeXBl":
|
40
|
-
- !binary |-
|
41
|
-
dGV4dC94bWw7Y2hhcnNldD0idXRmLTgi
|
25
|
+
Date:
|
26
|
+
- Mon, 17 Feb 2014 02:25:30 GMT
|
27
|
+
Server:
|
28
|
+
- Apache/2.2.3 (Red Hat)
|
29
|
+
X-Powered-By:
|
30
|
+
- Servlet/2.5 JSP/2.1
|
31
|
+
Connection:
|
32
|
+
- close
|
33
|
+
Transfer-Encoding:
|
34
|
+
- chunked
|
35
|
+
Content-Type:
|
36
|
+
- text/xml; charset=utf-8
|
42
37
|
body:
|
43
38
|
encoding: ASCII-8BIT
|
44
39
|
string: !binary |-
|
@@ -54,5 +49,5 @@ http_interactions:
|
|
54
49
|
ZXR1cm4+PC9uczI6Y29uc3VsdGFDRVBSZXNwb25zZT48L1M6Qm9keT48L1M6
|
55
50
|
RW52ZWxvcGU+
|
56
51
|
http_version:
|
57
|
-
recorded_at:
|
52
|
+
recorded_at: Mon, 17 Feb 2014 01:48:39 GMT
|
58
53
|
recorded_with: VCR 2.8.0
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'correios-cep'
|
2
|
+
require 'coveralls'
|
2
3
|
require 'vcr'
|
3
4
|
|
5
|
+
Coveralls.wear!
|
6
|
+
|
4
7
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
5
8
|
RSpec.configure do |config|
|
6
9
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
@@ -10,7 +13,7 @@ RSpec.configure do |config|
|
|
10
13
|
end
|
11
14
|
|
12
15
|
VCR.configure do |config|
|
13
|
-
config.default_cassette_options = { :match_requests_on => [:uri, :method, :body
|
16
|
+
config.default_cassette_options = { :match_requests_on => [:uri, :method, :body] }
|
14
17
|
config.cassette_library_dir = 'spec/fixtures/cassettes'
|
15
18
|
config.hook_into :webmock
|
16
19
|
config.configure_rspec_metadata!
|
metadata
CHANGED
@@ -1,97 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: correios-cep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prodis a.k.a. Fernando Hamasaki de Amorim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log-me
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: nokogiri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '2.14'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '2.14'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: vcr
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - ~>
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '2.8'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - ~>
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '2.8'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: webmock
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - ~>
|
101
|
+
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: 1.15.2
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - ~>
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: 1.15.2
|
97
111
|
description: Correios CEP gem gets updated Brazilian address from a zipcode, directly
|
@@ -102,8 +116,9 @@ executables: []
|
|
102
116
|
extensions: []
|
103
117
|
extra_rdoc_files: []
|
104
118
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .rspec
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".travis.yml"
|
107
122
|
- CHANGELOG.rdoc
|
108
123
|
- Gemfile
|
109
124
|
- README.rdoc
|
@@ -121,7 +136,7 @@ files:
|
|
121
136
|
- spec/correios/cep_spec.rb
|
122
137
|
- spec/fixtures/cassettes/correios_consulta_cep_ok.yml
|
123
138
|
- spec/spec_helper.rb
|
124
|
-
homepage:
|
139
|
+
homepage: http://prodis.blog.br/correios-cep-gem-para-consulta-de-enderecos-por-cep
|
125
140
|
licenses:
|
126
141
|
- MIT
|
127
142
|
metadata: {}
|
@@ -131,17 +146,17 @@ require_paths:
|
|
131
146
|
- lib
|
132
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
148
|
requirements:
|
134
|
-
- -
|
149
|
+
- - ">="
|
135
150
|
- !ruby/object:Gem::Version
|
136
151
|
version: 1.9.3
|
137
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
153
|
requirements:
|
139
|
-
- -
|
154
|
+
- - ">="
|
140
155
|
- !ruby/object:Gem::Version
|
141
156
|
version: '0'
|
142
157
|
requirements: []
|
143
158
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.2.2
|
145
160
|
signing_key:
|
146
161
|
specification_version: 4
|
147
162
|
summary: Correios CEP gem gets updated Brazilian address from a zipcode, directly
|