correios-cep 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d4333003fdd4446659ec47f2a89a3a38eceab45
4
- data.tar.gz: f702b0f5fffc1a6d45d6ffa2eb06c598dca9640e
3
+ metadata.gz: 693cb4991b7c16062b0a108dcd8b66442c1502cd
4
+ data.tar.gz: c70e4e05a67fcce3be1974b0883dcb41667ffce9
5
5
  SHA512:
6
- metadata.gz: 7f07bdb53fbff3d34d4bcd4ab82af4070bf0d4877ca66571e88c34253b7144767a971aee8d338cc3e0b2c29215d97d699b33bb6a0d63700b9b29e95044ea7875
7
- data.tar.gz: a75756a9b5cad3fd824200289f626b5864af3fef2f71f88293478f7023a8f1afe5a76d9661f6567ab673a0b7260b16328e6d4a1dbe36077206aa3e2280e108c3
6
+ metadata.gz: adf5ec16cfa8b4d4db9167f8ea666478aba3d8794b385720c10662523a977d369067d9e82365d9b0545e216f48f3f03df816428712d3314796b9b9db5e020ff9
7
+ data.tar.gz: cd5755c58ce306f64cd5204784ef8de4a6a3faa906e8d26e54a482096bfa5a8eeb6d1c6490ea52e97d5ff4167ac8c75f41ea7d801191f184595e013f8af595d7
data/.travis.yml CHANGED
@@ -4,5 +4,5 @@ rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1.5
7
- - 2.2.1
7
+ - 2.2.2
8
8
  script: bundle exec rspec
@@ -1,26 +1,30 @@
1
- == Version 0.3.1
1
+ ## Version 0.3.2
2
+ - Update: Optional HTTP requests using HTTP proxy.
3
+ - Improvement: Update LogMe gem version to 0.0.9.
4
+
5
+ ## Version 0.3.1
2
6
  - Warning: Minimal required Ruby version is 1.9.2 again.
3
7
 
4
- == Version 0.3.0
8
+ ## Version 0.3.0
5
9
  - Update: Update Correios Web Service URL.
6
10
 
7
- == Version 0.2.0
11
+ ## Version 0.2.0
8
12
  - Warning: Minimal required Ruby version from now is 1.9.3.
9
13
 
10
- == Version 0.1.4
14
+ ## Version 0.1.4
11
15
  - Improvement: Minimal required Ruby version now is 1.9.2.
12
16
 
13
- == Version 0.1.3
17
+ ## Version 0.1.3
14
18
  - Improvement: Update LogMe gem to version 0.0.6 with support to log request and response messages.
15
19
 
16
- == Version 0.1.2
20
+ ## Version 0.1.2
17
21
  - Improvement: Update LogMe gem to version 0.0.5 with support to log messages label.
18
22
 
19
- == Version 0.1.1
23
+ ## Version 0.1.1
20
24
  - New: A "get" class method in AddressFinder class.
21
25
 
22
- == Version 0.1.0
26
+ ## Version 0.1.0
23
27
  - First working version.
24
28
 
25
- == Version 0.0.1
29
+ ## Version 0.0.1
26
30
  - First version, not working yet.
@@ -1,4 +1,4 @@
1
- = correios-cep
1
+ # Correios CEP
2
2
 
3
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
4
 
@@ -6,34 +6,40 @@ This works with an HTTP request to the form, followed by parsing the HTML result
6
6
 
7
7
  Correios CEP gem solves this problem, getting data directly from Correios database.
8
8
 
9
- http://prodis.net.br/images/ruby/2011/correios_logo.png
9
+ ![Correios Logo](http://prodis.net.br/images/ruby/2011/correios_logo.png)
10
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]
11
+ [![Gem Version](https://badge.fury.io/rb/correios-cep.png)](http://badge.fury.io/rb/correios-cep)
12
+ [![Build Status](https://travis-ci.org/prodis/correios-cep.png?branch=master)](https://travis-ci.org/prodis/correios-cep)
13
+ [![Coverage Status](https://coveralls.io/repos/prodis/correios-cep/badge.png)](https://coveralls.io/r/prodis/correios-cep)
14
+ [![Code Climate](https://codeclimate.com/github/prodis/correios-cep.png)](https://codeclimate.com/github/prodis/correios-cep)
15
+ [![Dependency Status](https://gemnasium.com/prodis/correios-cep.png)](https://gemnasium.com/prodis/correios-cep)
16
16
 
17
+ ## Installing
17
18
 
18
- == Installing
19
+ ### Gemfile
19
20
 
20
- === Gemfile
21
+ ```ruby
21
22
  gem 'correios-cep'
23
+ ```
22
24
 
23
- === Direct installation
25
+ ### Direct installation
26
+
27
+ ```console
24
28
  $ gem install correios-cep
29
+ ```
25
30
 
26
31
 
27
- == Using
32
+ ## Using
28
33
 
34
+ ```ruby
29
35
  require 'correios-cep'
30
36
 
31
37
  # With "get" instance method
32
38
  finder = Correios::CEP::AddressFinder.new
33
- address = finder.get "54250610"
39
+ address = finder.get("54250610")
34
40
 
35
41
  # With "get" class method
36
- address = Correios::CEP::AddressFinder.get "54250610"
42
+ address = Correios::CEP::AddressFinder.get("54250610")
37
43
 
38
44
  address # =>
39
45
  {
@@ -44,24 +50,37 @@ http://prodis.net.br/images/ruby/2011/correios_logo.png
44
50
  :zipcode => "54250610",
45
51
  :complement => ""
46
52
  }
53
+ ```
47
54
 
55
+ ## Configurations
48
56
 
49
- == Configurations
50
-
51
- === Timeout
57
+ ### Timeout
52
58
 
53
- For default, the timeout for a request to Correios Web Service is <b>5 seconds</b>. If Correios Web Service does not respond, a <b>Timeout::Error</b> exception will be raised.
54
- You can configure this timeout using <b>Correios::CEP</b> module.
59
+ For default, the timeout for a request to Correios Web Service is **5 seconds**. If Correios Web Service does not respond, a `Timeout::Error` exception will be raised.
60
+ You can configure this timeout using `Correios::CEP` module.
55
61
 
62
+ ```ruby
56
63
  Correios::CEP.configure do |config|
57
64
  config.request_timeout = 3 # It configures timeout to 3 seconds
58
65
  end
66
+ ```
67
+
68
+ ### HTTP Proxy
69
+ If you need to use an HTTP proxy to HTTP requests, configure the HTTP proxy URL on `Correios::CEP` module.
70
+
71
+ ```ruby
72
+ Correios::CEP.configure do |config|
73
+ config.proxy_url = "http://10.20.30.40:8888"
74
+ end
75
+ ```
59
76
 
60
- === Log
77
+ ### Log
61
78
 
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].
79
+ For default, each request to Correios Web service is logged to STDOUT, with **:info** log level, using the gem [LogMe](http://github.com/prodis/log-me).
63
80
 
64
81
  Log example:
82
+
83
+ ```xml
65
84
  I, [2014-02-14T00:10:12.718413 #76361] INFO -- : [Correios::CEP] Request:
66
85
  POST http://200.252.60.209/SigepCliente/AtendeClienteService
67
86
  <?xml version="1.0" encoding="UTF-8"?>
@@ -93,50 +112,54 @@ Log example:
93
112
  </ns2:consultaCEPResponse>
94
113
  </S:Body>
95
114
  </S:Envelope>
115
+ ```
96
116
 
97
- To disable the log and configure other log output, use <b>Correios::CEP</b> module:
117
+ To disable the log and configure other log output, use **Correios::CEP** module:
98
118
 
119
+ ```ruby
99
120
  Correios::CEP.configure do |config|
100
121
  config.log_enabled = false # It disables the log
101
122
  config.logger = Rails.logger # It uses Rails logger
102
123
  end
124
+ ```
103
125
 
104
- === Configuration example
126
+ ### Configuration example
105
127
 
128
+ ```ruby
106
129
  Correios::CEP.configure do |config|
107
130
  config.logger = Rails.logger
108
131
  config.request_timeout = 3
109
132
  end
133
+ ```
110
134
 
111
-
112
- == Author
113
- - {Fernando Hamasaki de Amorim (prodis)}[http://prodis.blog.br]
135
+ ## Author
136
+ - [Fernando Hamasaki de Amorim (prodis)](http://prodis.blog.br)
114
137
 
115
138
 
116
- == Contributing to correios-cep
139
+ ## Contributing to correios-cep
117
140
 
118
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
119
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
120
- * Fork the project.
121
- * Start a feature/bugfix branch.
122
- * Commit and push until you are happy with your contribution.
123
- * Don't forget to rebase with branch master in main project before submit the pull request.
124
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
125
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
141
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
142
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
143
+ - Fork the project.
144
+ - Start a feature/bugfix branch.
145
+ - Commit and push until you are happy with your contribution.
146
+ - Don't forget to rebase with branch master in main project before submit the pull request.
147
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
148
+ - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
126
149
 
127
150
 
128
- == Copyright
151
+ ## Copyright
129
152
 
130
153
  (The MIT License)
131
154
 
132
- {Prodis a.k.a. Fernando Hamasaki de Amorim}[http://prodis.blog.br]
155
+ [Prodis a.k.a. Fernando Hamasaki de Amorim](http://prodis.blog.br)
133
156
 
134
- http://prodis.net.br/images/prodis_150.gif
157
+ ![Prodis Logo](http://prodis.net.br/images/prodis_150.gif)
135
158
 
136
- Copyright (c) 2014 Prodis
159
+ Copyright &copy; 2014-2015 Prodis
137
160
 
138
161
  Permission is hereby granted, free of charge, to any person obtaining
139
- a copy of this software and associated documentation files (the
162
+ a copy of this software and associated documentation files (the
140
163
  "Software"), to deal in the Software without restriction, including
141
164
  without limitation the rights to use, copy, modify, merge, publish,
142
165
  distribute, sublicense, and/or sell copies of the Software, and to
data/correios-cep.gemspec CHANGED
@@ -3,30 +3,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'correios/cep/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "correios-cep"
6
+ spec.name = 'correios-cep'
7
7
  spec.version = Correios::CEP::VERSION
8
- spec.authors = ["Prodis a.k.a. Fernando Hamasaki de Amorim"]
9
- spec.email = ["prodis@gmail.com"]
8
+ spec.authors = ['Prodis a.k.a. Fernando Hamasaki de Amorim']
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.}
11
11
  spec.summary = spec.description
12
- spec.homepage = "http://prodis.blog.br/correios-cep-gem-para-consulta-de-enderecos-por-cep"
13
- spec.license = "MIT"
12
+ spec.homepage = 'http://prodis.blog.br/correios-cep-gem-para-consulta-de-enderecos-por-cep'
13
+ spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
- spec.require_paths = ["lib"]
18
+ spec.require_paths = ['lib']
19
19
 
20
20
  spec.platform = Gem::Platform::RUBY
21
- spec.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
21
+ spec.required_ruby_version = Gem::Requirement.new('>= 1.9.2')
22
22
 
23
- spec.add_dependency "log-me", "= 0.0.7"
24
- spec.add_dependency "nokogiri", "~> 1.6"
23
+ spec.add_dependency 'log-me', '= 0.0.9'
24
+ spec.add_dependency 'nokogiri', '~> 1.6'
25
25
 
26
- spec.add_development_dependency "coveralls"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec", "~> 3.1"
30
- spec.add_development_dependency "vcr", "~> 2.9"
31
- spec.add_development_dependency "webmock", "~> 1.15"
26
+ spec.add_development_dependency 'coveralls'
27
+ spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'rake'
29
+ spec.add_development_dependency 'rspec', '~> 3.2'
30
+ spec.add_development_dependency 'vcr', '~> 2.9'
31
+ spec.add_development_dependency 'webmock', '~> 1.21'
32
32
  end
data/lib/correios-cep.rb CHANGED
@@ -1,4 +1,5 @@
1
- require 'correios/cep'
1
+ require 'correios/cep/config'
2
2
  require 'correios/cep/address_finder'
3
3
  require 'correios/cep/parser'
4
4
  require 'correios/cep/web_service'
5
+ require 'correios/cep'
data/lib/correios/cep.rb CHANGED
@@ -3,16 +3,6 @@ require 'log-me'
3
3
  module Correios
4
4
  module CEP
5
5
  extend LogMe
6
-
7
- module Timeout
8
- DEFAULT_REQUEST_TIMEOUT = 5 #seconds
9
- attr_writer :request_timeout
10
-
11
- def request_timeout
12
- (@request_timeout ||= DEFAULT_REQUEST_TIMEOUT).to_i
13
- end
14
- end
15
-
16
- extend Timeout
6
+ extend Correios::CEP::Config
17
7
  end
18
8
  end
@@ -2,12 +2,12 @@ module Correios
2
2
  module CEP
3
3
  class AddressFinder
4
4
  def get(zipcode)
5
- response = web_service.request! zipcode
6
- parser.address response
5
+ response = web_service.request(zipcode)
6
+ parser.address(response)
7
7
  end
8
8
 
9
9
  def self.get(zipcode)
10
- self.new.get zipcode
10
+ self.new.get(zipcode)
11
11
  end
12
12
 
13
13
  private
@@ -0,0 +1,16 @@
1
+ module Correios
2
+ module CEP
3
+ module Config
4
+ DEFAULT_REQUEST_TIMEOUT = 5 #seconds
5
+ attr_writer :proxy_url, :request_timeout
6
+
7
+ def proxy_url
8
+ @proxy_url ||= ''
9
+ end
10
+
11
+ def request_timeout
12
+ (@request_timeout ||= DEFAULT_REQUEST_TIMEOUT).to_i
13
+ end
14
+ end
15
+ end
16
+ end
@@ -4,17 +4,17 @@ module Correios
4
4
  module CEP
5
5
  class Parser
6
6
  ADDRESS_MAP = {
7
- "end" => :address,
8
- "bairro" => :neighborhood,
9
- "cidade" => :city,
10
- "uf" => :state,
11
- "cep" => :zipcode,
12
- "complemento" => :complement,
13
- "complemento2" => :complement2,
7
+ 'end' => :address,
8
+ 'bairro' => :neighborhood,
9
+ 'cidade' => :city,
10
+ 'uf' => :state,
11
+ 'cep' => :zipcode,
12
+ 'complemento' => :complement,
13
+ 'complemento2' => :complement2,
14
14
  }.freeze
15
15
 
16
16
  def address(xml)
17
- result = Nokogiri::XML(xml).xpath("//return")
17
+ result = Nokogiri::XML(xml).xpath('//return')
18
18
  return if result.nil? || result.empty?
19
19
 
20
20
  address = {}
@@ -1,5 +1,5 @@
1
1
  module Correios
2
2
  module CEP
3
- VERSION = "0.3.1"
3
+ VERSION = '0.3.2'
4
4
  end
5
5
  end
@@ -4,38 +4,50 @@ require 'uri'
4
4
  module Correios
5
5
  module CEP
6
6
  class WebService
7
- URL = "https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente"
7
+ URL = 'https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente'
8
8
 
9
9
  def initialize
10
10
  @uri = URI.parse(URL)
11
+ @proxy_uri = URI.parse(Correios::CEP.proxy_url)
11
12
  end
12
13
 
13
- def request!(zipcode)
14
+ def request(zipcode)
14
15
  http = build_http
15
16
 
16
- request = build_request zipcode
17
- Correios::CEP.log_request request, @uri.to_s
17
+ request = build_request(zipcode)
18
+ Correios::CEP.log_request(request, uri.to_s)
18
19
 
19
- response = http.request request
20
- Correios::CEP.log_response response
20
+ response = http.request(request)
21
+ Correios::CEP.log_response(response)
22
+
23
+ http.finish if http.started?
21
24
 
22
25
  response.body
23
26
  end
24
27
 
25
28
  private
26
29
 
30
+ attr_reader :uri, :proxy_uri
31
+
27
32
  def build_http
28
- http = Net::HTTP.new(@uri.host, @uri.port)
29
- http.open_timeout = Correios::CEP.request_timeout
30
- http.use_ssl = true
31
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
32
- http
33
+ Net::HTTP.start(
34
+ uri.host,
35
+ uri.port,
36
+ proxy_uri.host,
37
+ proxy_uri.port,
38
+ nil,
39
+ nil,
40
+ use_ssl: true,
41
+ verify_mode: OpenSSL::SSL::VERIFY_NONE,
42
+ open_timeout: Correios::CEP.request_timeout,
43
+ read_timeout: Correios::CEP.request_timeout
44
+ )
33
45
  end
34
46
 
35
47
  def build_request(zipcode)
36
- request = Net::HTTP::Post.new(@uri.path)
37
- request["Content-Type"] = "text/xml; charset=utf-8"
38
- request.body = request_body zipcode
48
+ request = Net::HTTP::Post.new(uri.path)
49
+ request['Content-Type'] = 'text/xml; charset=utf-8'
50
+ request.body = request_body(zipcode)
39
51
  request
40
52
  end
41
53
 
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Correios::CEP::AddressFinder do
4
- let(:cep) { "54250610" }
5
- let(:web_service_response) { "<end>Rua Fernando Amorim</end>" }
6
- let(:address) { { address: "Rua Fernando Amorim" } }
4
+ let(:cep) { '54250610' }
5
+ let(:web_service_response) { '<end>Rua Fernando Amorim</end>' }
6
+ let(:address) { { address: 'Rua Fernando Amorim' } }
7
7
 
8
8
  before do
9
- allow_any_instance_of(Correios::CEP::WebService).to receive(:request!).with(cep).and_return(web_service_response)
9
+ allow_any_instance_of(Correios::CEP::WebService).to receive(:request).with(cep).and_return(web_service_response)
10
10
  allow_any_instance_of(Correios::CEP::Parser).to receive(:address).with(web_service_response).and_return(address)
11
11
  end
12
12
 
13
- describe "#get" do
14
- it "returns address" do
15
- expect(subject.get(cep)).to eq address
13
+ describe '#get' do
14
+ it 'returns address' do
15
+ expect(subject.get(cep)).to eql address
16
16
  end
17
17
  end
18
18
 
19
- describe ".get" do
20
- it "returns address" do
21
- expect(Correios::CEP::AddressFinder.get(cep)).to eq address
19
+ describe '.get' do
20
+ it 'returns address' do
21
+ expect(Correios::CEP::AddressFinder.get(cep)).to eql address
22
22
  end
23
23
  end
24
24
  end
@@ -2,8 +2,8 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Correios::CEP::Parser do
5
- describe "#address" do
6
- context "when address is found" do
5
+ describe '#address' do
6
+ context 'when address is found' do
7
7
  let(:xml) do
8
8
  "<?xml version='1.0' encoding='UTF-8'?>" +
9
9
  "<S:Envelope>" +
@@ -25,21 +25,21 @@ describe Correios::CEP::Parser do
25
25
  end
26
26
  let(:expected_address) do
27
27
  {
28
- address: "Rua Fernando Amorim",
29
- neighborhood: "Cavaleiro",
30
- city: "Jaboatão dos Guararapes",
31
- state: "PE",
32
- zipcode: "54250610",
33
- complement: "de 1500 até o fim (zona mista)"
28
+ address: 'Rua Fernando Amorim',
29
+ neighborhood: 'Cavaleiro',
30
+ city: 'Jaboatão dos Guararapes',
31
+ state: 'PE',
32
+ zipcode: '54250610',
33
+ complement: 'de 1500 até o fim (zona mista)'
34
34
  }
35
35
  end
36
36
 
37
- it "returns address" do
37
+ it 'returns address' do
38
38
  expect(subject.address(xml)).to eq expected_address
39
39
  end
40
40
  end
41
41
 
42
- context "when address is not found" do
42
+ context 'when address is not found' do
43
43
  let(:xml) do
44
44
  "<?xml version='1.0' encoding='UTF-8'?>" +
45
45
  "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
@@ -49,7 +49,7 @@ describe Correios::CEP::Parser do
49
49
  "</S:Envelope>"
50
50
  end
51
51
 
52
- it "returns nil" do
52
+ it 'returns nil' do
53
53
  expect(subject.address(xml)).to be_nil
54
54
  end
55
55
  end
@@ -1,18 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Correios::CEP::WebService do
4
- let(:cep) { "54250610" }
4
+ let(:cep) { '54250610' }
5
5
 
6
- describe "#request!", vcr: { cassette_name: "correios_consulta_cep_ok" } do
6
+ describe '#request', vcr: { cassette_name: 'correios_consulta_cep_ok' } do
7
7
  around do |example|
8
8
  Correios::CEP.log_enabled = false
9
9
  example.run
10
10
  Correios::CEP.log_enabled = true
11
11
  end
12
12
 
13
- it "returns HTTP response body from Correios Web Service" do
14
- result = subject.request! cep
15
- expect(result).to include("Rua Fernando Amorim")
13
+ it 'returns HTTP response body from Correios Web Service' do
14
+ result = subject.request(cep)
15
+ expect(result).to include('Rua Fernando Amorim')
16
16
  end
17
17
  end
18
18
  end
@@ -1,6 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Correios::CEP do
4
+ describe '#proxy_url' do
5
+ it 'default is empty' do
6
+ expect(Correios::CEP.proxy_url).to eql ''
7
+ end
8
+
9
+ context 'when set proxy URL' do
10
+ it 'returns proxy URL' do
11
+ Correios::CEP.configure { |config| config.proxy_url = 'http://10.20.30.40:8888' }
12
+ expect(Correios::CEP.proxy_url).to eql 'http://10.20.30.40:8888'
13
+ end
14
+ end
15
+ end
16
+
4
17
  describe "#request_timeout" do
5
18
  it "default is 5" do
6
19
  expect(Correios::CEP.request_timeout).to eql 5
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,7 @@ Coveralls.wear!
8
8
  RSpec.configure do |config|
9
9
  config.run_all_when_everything_filtered = true
10
10
  config.filter_run :focus
11
- config.order = "random"
11
+ config.order = 'random'
12
12
  end
13
13
 
14
14
  VCR.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: correios-cep
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.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: 2015-03-24 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: log-me
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.7
19
+ version: 0.0.9
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.7
26
+ version: 0.0.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.1'
89
+ version: '3.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.1'
96
+ version: '3.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.15'
117
+ version: '1.21'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.15'
124
+ version: '1.21'
125
125
  description: Correios CEP gem gets updated Brazilian address from a zipcode, directly
126
126
  from Correios database. No HTML parsers.
127
127
  email:
@@ -133,14 +133,15 @@ files:
133
133
  - ".gitignore"
134
134
  - ".rspec"
135
135
  - ".travis.yml"
136
- - CHANGELOG.rdoc
136
+ - CHANGELOG.md
137
137
  - Gemfile
138
- - README.rdoc
138
+ - README.md
139
139
  - Rakefile
140
140
  - correios-cep.gemspec
141
141
  - lib/correios-cep.rb
142
142
  - lib/correios/cep.rb
143
143
  - lib/correios/cep/address_finder.rb
144
+ - lib/correios/cep/config.rb
144
145
  - lib/correios/cep/parser.rb
145
146
  - lib/correios/cep/version.rb
146
147
  - lib/correios/cep/web_service.rb