correios-cep 0.7.1 → 0.8.0

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
  SHA256:
3
- metadata.gz: 60c18b73fd065415c0c648a5f0aead23366874e1b734f92f2a240d094d0c1dbf
4
- data.tar.gz: c5c9faaf88a41de2a4dd1989d1c4e947093ac86f3a7cb998c0dd72501027d591
3
+ metadata.gz: 2066f2ee01e2ba3796c4304b2826f46291b96ddce5b0d20b6db9c865e189d55c
4
+ data.tar.gz: 6059469b5dd7aef91970ef3e9da8299d2350795324b48e287b9527a80f88648d
5
5
  SHA512:
6
- metadata.gz: 9ad6717270026f3b563025e0f820fecb880c2223974e20ecda86dfcf22bdc0c58c479b2c3e76d42a65d7c61a975a234ca0259eb37282f68f0876e9780aa9e49a
7
- data.tar.gz: 334ca5e791300628e2455ab29db86c16aaf5491a2dc526c3ed563c8126c3f4b6a35762f76d79c4a926cdb2bb87f41f4094bbf1009f7e9aa2c62d37280a77910e
6
+ metadata.gz: d3b4531797b263287fb9bd972c208d356de2ed2f8599014765c801ae8b29deb70801ba48721022bc1c1c5f222d63035ad3c3126b32be7ea7320e0f119b9ee5eb
7
+ data.tar.gz: 3b6b0c9f5567377003fa3c033ed54fc74d0ea3371066db23974af3669fa93877bb1d7015f198f1bcd30e7dbb007badd9c0b48af18804f0f7ef5bea4a194bcff3
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.2.10
5
- - 2.3.7
6
- - 2.4.4
7
- - 2.5.1
8
- - 2.6
4
+ - 2.3.8
5
+ - 2.4.6
6
+ - 2.5.5
7
+ - 2.6.3
8
+ - 2.7.0
9
9
  - ruby-head
10
10
  - jruby
11
11
  - jruby-9
@@ -14,11 +14,11 @@ rvm:
14
14
  - rbx
15
15
  - rbx-2
16
16
  - rbx-3
17
+ - rbx-4
17
18
  - rbx-head
18
19
 
19
20
  matrix:
20
21
  allow_failures:
21
- - rvm: 2.6
22
22
  - rvm: jruby
23
23
  - rvm: jruby-9
24
24
  - rvm: jruby-19mode
@@ -27,6 +27,7 @@ matrix:
27
27
  - rvm: rbx
28
28
  - rvm: rbx-2
29
29
  - rvm: rbx-3
30
+ - rvm: rbx-4
30
31
  - rvm: rbx-head
31
32
  fast_finish: true
32
33
 
@@ -1,27 +1,123 @@
1
- | Version | Changes |
2
- | ------- | ------- |
3
- | 0.7.1 | Fix uninitialised constant error [Issue #23](https://github.com/prodis/correios-cep/issues/23) |
4
- | 0.7.0 | Replace Net::HTTP to HTTP gem. [Issue #15](https://github.com/prodis/correios-cep/issues/15); Remove `log-me` gem; Minimal required Ruby version now is 2.2.0. |
5
- | 0.6.8 | Fix parsing bug when Correios API omits "complemento" XML node in response. |
6
- | 0.6.7 | Update Ox gem version to `2.9`. |
7
- | 0.6.6 | Update Ox gem version to `2.8.4`. |
8
- | 0.6.5 | Update Ox gem version to `2.8.2`. [PR #17](https://github.com/prodis/correios-cep/pull/17) |
9
- | 0.6.4 | Update Ox gem version to `2.4.13`. |
10
- | 0.6.3 | Improve performance regarding strings. |
11
- | 0.6.2 | Update Ox gem version to `2.4`. [PR #14](https://github.com/prodis/correios-cep/pull/14) |
12
- | 0.6.1 | Update LogMe gem version to `0.0.10`. |
13
- | 0.6.0 | Minimal required Ruby version from now is 2.0.0. |
14
- | 0.5.1 | Zipcode input validation improvement. |
15
- | 0.5.0 | Handle errors returned from Correios web service. [Issue #10](https://github.com/prodis/correios-cep/issues/10); Zipcode input validation. |
16
- | 0.4.0 | Replace Nokogiri by Ox. [Issue #3](https://github.com/prodis/correios-cep/issues/3) |
17
- | 0.3.3 | Downgrade LogMe gem version to `0.0.8`, because `0.0.9` does not support Ruby 1.9.2. |
18
- | 0.3.2 | Optional use of HTTP proxy; Update LogMe gem version to `0.0.9`. |
19
- | 0.3.1 | Minimal required Ruby version is 1.9.2 again. |
20
- | 0.3.0 | Update Correios web service URL. |
21
- | 0.2.0 | Minimal required Ruby version from now is 1.9.3. |
22
- | 0.1.4 | Minimal required Ruby version now is 1.9.2. |
23
- | 0.1.3 | Update LogMe gem to version `0.0.6` with support to log request and response messages. |
24
- | 0.1.2 | Update LogMe gem to version `0.0.5` with support to log messages label. |
25
- | 0.1.1 | `AddressFinder.get` class method. |
26
- | 0.1.0 | First working version. |
27
- | 0.0.1 | First version, not working yet. |
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.8.0] - 2020-02-17
10
+ ### Changed
11
+ - Update Ox gem version to `2.13`.
12
+ - Update HTTP gem version to `4.3`.
13
+ - Minimal required Ruby version now is 2.3.0.
14
+
15
+ ## [0.7.1] - 2018-11-19
16
+ ### Fixed
17
+ - Fix uninitialised constant error [Issue #23](https://github.com/prodis/correios-cep/issues/23)
18
+
19
+ ## [0.7.0] - 2018-11-18
20
+ ### Changed
21
+ - Replace Net::HTTP to HTTP gem. [Issue #15](https://github.com/prodis/correios-cep/issues/15)
22
+ - Minimal required Ruby version now is 2.2.0.
23
+
24
+ ### Removed
25
+ - Remove `log-me` gem.
26
+
27
+ ## [0.6.8] - 2018-11-01
28
+ ### Fixed
29
+ - Fix parsing bug when Correios API omits "complemento" XML node in response.
30
+
31
+ ## [0.6.7] - 2018-03-19
32
+ ### Changed
33
+ - Update Ox gem version to `2.9`.
34
+
35
+ ## [0.6.6] - 2018-03-13
36
+ ### Changed
37
+ - Update Ox gem version to `2.8.4`.
38
+
39
+ ## [0.6.5] - 2017-12-04
40
+ ### Changed
41
+ - Update Ox gem version to `2.8.2`. [PR #17](https://github.com/prodis/correios-cep/pull/17)
42
+
43
+ ## [0.6.4] - 2017-04-23
44
+ ### Changed
45
+ - Update Ox gem version to `2.4.13`.
46
+
47
+ ## [0.6.3] - 2017-03-19
48
+ ### Changed
49
+ - Improve performance regarding strings.
50
+
51
+ ## [0.6.2] - 2017-03-18
52
+ ### Changed
53
+ - Update Ox gem version to `2.4`. [PR #14](https://github.com/prodis/correios-cep/pull/14)
54
+
55
+ ## [0.6.1] - 2015-12-17
56
+ ### Changed
57
+ - Update LogMe gem version to `0.0.10`.
58
+
59
+ ## [0.6.0] - 2015-11-10
60
+ ### Changed
61
+ - Minimal required Ruby version now is 2.0.0.
62
+
63
+ ## [0.5.1] - 2015-11-03
64
+ ### Changed
65
+ - Zipcode input validation improvement.
66
+
67
+ ## [0.5.0] - 2015-10-30
68
+ ### Added
69
+ - Zipcode input validation.
70
+
71
+ ### Fixed
72
+ - Handle errors returned from Correios web service. [Issue #10](https://github.com/prodis/correios-cep/issues/10)
73
+
74
+ ## [0.4.0] - 2015-04-29
75
+ ### Changed
76
+ - Replace Nokogiri by Ox. [Issue #3](https://github.com/prodis/correios-cep/issues/3)
77
+
78
+ ## [0.3.3] - 2015-04-24
79
+ ### Changed
80
+ - Downgrade LogMe gem version to `0.0.8`, because `0.0.9` does not support Ruby 1.9.2.
81
+
82
+ ## [0.3.2] - 2015-04-24
83
+ ### Added
84
+ - Optional use of HTTP proxy.
85
+
86
+ ### Changed
87
+ - Update LogMe gem version to `0.0.9`.
88
+
89
+ ## [0.3.1] - 2015-03-24
90
+ ### Changed
91
+ - Minimal required Ruby version now is 1.9.2 again.
92
+
93
+ ## [0.3.0] - 2015-03-20
94
+ ### Changed
95
+ - Update Correios web service URL.
96
+
97
+ ## [0.2.0] - 2014-11-14
98
+ ### Changed
99
+ - Minimal required Ruby version now is 1.9.3.
100
+
101
+ ## [0.1.4] - 2014-06-27
102
+ ### Changed
103
+ - Minimal required Ruby version now is 1.9.2.
104
+
105
+ ## [0.1.3] - 2014-02-21
106
+ ### Changed
107
+ - Update LogMe gem to version `0.0.6` with support to log request and response messages.
108
+
109
+ ## [0.1.2] - 2014-02-19
110
+ ### Changed
111
+ - Update LogMe gem to version `0.0.5` with support to log messages label.
112
+
113
+ ## [0.1.1] - 2014-02-14
114
+ ### Added
115
+ - `AddressFinder.get` class method.
116
+
117
+ ## [0.1.0] - 2014-02-14
118
+ ### Added
119
+ - First working version.
120
+
121
+ ## [0.0.1] - 2014-02-12
122
+ ### Added
123
+ - First version, not working yet.
data/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright (c) 2014-2018 Fernando Hamasaki de Amorim
189
+ Copyright (c) 2014-2020 Fernando Hamasaki de Amorim
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -103,12 +103,7 @@ end
103
103
  ![Prodis Logo](https://camo.githubusercontent.com/c01a3ebca1c000d7586a998bb07316c8cb784ce5/687474703a2f2f70726f6469732e6e65742e62722f696d616765732f70726f6469735f3135302e676966)
104
104
 
105
105
  ### Contributors
106
- - [Gabriel Givigier Guimarães (givigier)](https://github.com/givigier)
107
- - [Marlon Henry Schweigert (Schweigert)](https://github.com/Schweigert)
108
- - [Mateus Luiz (mateusluizfb)](https://github.com/mateusluizfb)
109
- - [Maury M. Marques (maurymmarques)](https://github.com/maurymmarques)
110
- - [Rafael Garcia (rafbgarcia)](https://github.com/rafbgarcia)
111
-
106
+ https://github.com/prodis/correios-cep/graphs/contributors
112
107
 
113
108
  ## Contributing
114
109
 
@@ -19,15 +19,15 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.platform = Gem::Platform::RUBY
22
- spec.required_ruby_version = Gem::Requirement.new('>= 2.2.0')
22
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
23
23
 
24
- spec.add_dependency 'ox', '~> 2.9'
25
- spec.add_dependency 'http', '~> 4.0.0'
24
+ spec.add_dependency 'ox', '~> 2.13'
25
+ spec.add_dependency 'http', '~> 4.3'
26
26
 
27
- spec.add_development_dependency 'coveralls', '~> 0.8.21'
28
- spec.add_development_dependency 'pry', '~> 0.11.3'
29
- spec.add_development_dependency 'rake', '~> 12.3'
30
- spec.add_development_dependency 'rspec', '~> 3.7'
31
- spec.add_development_dependency 'vcr', '~> 4.0'
32
- spec.add_development_dependency 'webmock', '~> 3.3'
27
+ spec.add_development_dependency 'coveralls', '~> 0.8.23'
28
+ spec.add_development_dependency 'pry', '~> 0.12.2'
29
+ spec.add_development_dependency 'rake', '~> 13.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.9'
31
+ spec.add_development_dependency 'vcr', '~> 5.1'
32
+ spec.add_development_dependency 'webmock', '~> 3.8'
33
33
  end
@@ -20,10 +20,12 @@ module Correios
20
20
  return_node = find_node(doc.nodes, 'return')
21
21
  return {} if return_node.nil?
22
22
 
23
- address = {}
24
- return_node.nodes.each do |element|
25
- address[ADDRESS_MAP[element.name]] = text_for(element) if ADDRESS_MAP[element.name]
26
- end
23
+ address =
24
+ return_node.nodes.reduce({}) do |address_accumulator, element|
25
+ key = ADDRESS_MAP[element.name]
26
+ address_accumulator[key] = text_for(element) if key
27
+ address_accumulator
28
+ end
27
29
 
28
30
  join_complements(address)
29
31
  address
@@ -40,7 +42,7 @@ module Correios
40
42
  end
41
43
 
42
44
  def text_for(element)
43
- element.text.to_s.force_encoding(Encoding::UTF_8)
45
+ element.text.nil? ? "" : element.text.force_encoding(Encoding::UTF_8)
44
46
  end
45
47
 
46
48
  def join_complements(address)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Correios
3
3
  module CEP
4
- VERSION = '0.7.1'
4
+ VERSION = '0.8.0'
5
5
  end
6
6
  end
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.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Hamasaki de Amorim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-19 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox
@@ -16,112 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.9'
19
+ version: '2.13'
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: '2.9'
26
+ version: '2.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: http
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: '4.3'
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
- version: 4.0.0
40
+ version: '4.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.21
47
+ version: 0.8.23
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.21
54
+ version: 0.8.23
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.11.3
61
+ version: 0.12.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.11.3
68
+ version: 0.12.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '12.3'
75
+ version: '13.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '12.3'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.7'
89
+ version: '3.9'
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.7'
96
+ version: '3.9'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: vcr
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '4.0'
103
+ version: '5.1'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '4.0'
110
+ version: '5.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.3'
117
+ version: '3.8'
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: '3.3'
124
+ version: '3.8'
125
125
  description: Correios CEP gem finds updated Brazilian addresses by zipcode, directly
126
126
  from Correios database. No HTML parsers.
127
127
  email: prodis@gmail.com
@@ -165,15 +165,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - ">="
167
167
  - !ruby/object:Gem::Version
168
- version: 2.2.0
168
+ version: 2.3.0
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.7.7
175
+ rubygems_version: 3.1.0.pre1
177
176
  signing_key:
178
177
  specification_version: 4
179
178
  summary: Correios CEP gem finds updated Brazilian addresses by zipcode, directly from