brazil-cep 0.1.0 → 0.2.0
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 +4 -4
- data/.rubocop.yml +153 -0
- data/CHANGELOG.md +19 -0
- data/README.md +5 -1
- data/Rakefile +4 -4
- data/lib/brazil_cep/adapters/postmon.rb +1 -1
- data/lib/brazil_cep/adapters/republica_virtual.rb +1 -1
- data/lib/brazil_cep/adapters/viacep.rb +1 -1
- data/lib/brazil_cep/adapters.rb +24 -1
- data/lib/brazil_cep/address.rb +2 -2
- data/lib/brazil_cep/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f79497f3008ab411781e49694a291d7e68b6aa13e9f26e98cdc4dd9bc16a346
|
|
4
|
+
data.tar.gz: a17b09d8556f278136becb604b8db054cf5e4b0cb4ab16c848485a6611667a45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf50938524c7564d0aefa7a29e4b5f20898842f2b2e3f9067ea897d0516e9e81db5683586dd0c67de28b3b626bab773d2b1cc0ae1bb25c4c644c6314e34e99cc
|
|
7
|
+
data.tar.gz: 53f25c7996df1aac9121a66ea28657badcac31c6866befcfc1c4ef6e6c523b0628925b45a83f99eb77169cd0360eb1ce4a36ed54365930e4744a525545cb9def
|
data/.rubocop.yml
CHANGED
|
@@ -11,3 +11,156 @@ Style/StringLiteralsInInterpolation:
|
|
|
11
11
|
|
|
12
12
|
Layout/LineLength:
|
|
13
13
|
Max: 120
|
|
14
|
+
|
|
15
|
+
AllCops:
|
|
16
|
+
NewCops: enable
|
|
17
|
+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
|
18
|
+
Enabled: true
|
|
19
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
|
20
|
+
Enabled: true
|
|
21
|
+
Gemspec/RequireMFA: # new in 1.23
|
|
22
|
+
Enabled: true
|
|
23
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
|
24
|
+
Enabled: true
|
|
25
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
|
26
|
+
Enabled: true
|
|
27
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
|
28
|
+
Enabled: true
|
|
29
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
|
30
|
+
Enabled: true
|
|
31
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
|
32
|
+
Enabled: true
|
|
33
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
|
34
|
+
Enabled: true
|
|
35
|
+
Lint/AmbiguousRange: # new in 1.19
|
|
36
|
+
Enabled: true
|
|
37
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
|
38
|
+
Enabled: true
|
|
39
|
+
Lint/DeprecatedConstants: # new in 1.8
|
|
40
|
+
Enabled: true
|
|
41
|
+
Lint/DuplicateBranch: # new in 1.3
|
|
42
|
+
Enabled: true
|
|
43
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
|
44
|
+
Enabled: true
|
|
45
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
|
46
|
+
Enabled: true
|
|
47
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
|
48
|
+
Enabled: true
|
|
49
|
+
Lint/EmptyBlock: # new in 1.1
|
|
50
|
+
Enabled: true
|
|
51
|
+
Lint/EmptyClass: # new in 1.3
|
|
52
|
+
Enabled: true
|
|
53
|
+
Lint/EmptyInPattern: # new in 1.16
|
|
54
|
+
Enabled: true
|
|
55
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
|
56
|
+
Enabled: true
|
|
57
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
|
58
|
+
Enabled: true
|
|
59
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
|
60
|
+
Enabled: true
|
|
61
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
|
62
|
+
Enabled: true
|
|
63
|
+
Lint/MixedCaseRange: # new in 1.53
|
|
64
|
+
Enabled: true
|
|
65
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
|
66
|
+
Enabled: true
|
|
67
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
|
68
|
+
Enabled: true
|
|
69
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
|
70
|
+
Enabled: true
|
|
71
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
|
72
|
+
Enabled: true
|
|
73
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
|
74
|
+
Enabled: true
|
|
75
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
|
76
|
+
Enabled: true
|
|
77
|
+
Lint/RefinementImportMethods: # new in 1.27
|
|
78
|
+
Enabled: true
|
|
79
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
|
80
|
+
Enabled: true
|
|
81
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
|
82
|
+
Enabled: true
|
|
83
|
+
Lint/SymbolConversion: # new in 1.9
|
|
84
|
+
Enabled: true
|
|
85
|
+
Lint/ToEnumArguments: # new in 1.1
|
|
86
|
+
Enabled: true
|
|
87
|
+
Lint/TripleQuotes: # new in 1.9
|
|
88
|
+
Enabled: true
|
|
89
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
|
90
|
+
Enabled: true
|
|
91
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
|
92
|
+
Enabled: true
|
|
93
|
+
Lint/UselessRescue: # new in 1.43
|
|
94
|
+
Enabled: true
|
|
95
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
|
96
|
+
Enabled: true
|
|
97
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
|
98
|
+
Enabled: true
|
|
99
|
+
Naming/BlockForwarding: # new in 1.24
|
|
100
|
+
Enabled: true
|
|
101
|
+
Security/CompoundHash: # new in 1.28
|
|
102
|
+
Enabled: true
|
|
103
|
+
Security/IoMethods: # new in 1.22
|
|
104
|
+
Enabled: true
|
|
105
|
+
Style/ArgumentsForwarding: # new in 1.1
|
|
106
|
+
Enabled: true
|
|
107
|
+
Style/ArrayIntersect: # new in 1.40
|
|
108
|
+
Enabled: true
|
|
109
|
+
Style/CollectionCompact: # new in 1.2
|
|
110
|
+
Enabled: true
|
|
111
|
+
Style/ComparableClamp: # new in 1.44
|
|
112
|
+
Enabled: true
|
|
113
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
|
114
|
+
Enabled: true
|
|
115
|
+
Style/DataInheritance: # new in 1.49
|
|
116
|
+
Enabled: true
|
|
117
|
+
Style/DirEmpty: # new in 1.48
|
|
118
|
+
Enabled: true
|
|
119
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
|
120
|
+
Enabled: true
|
|
121
|
+
Style/EmptyHeredoc: # new in 1.32
|
|
122
|
+
Enabled: true
|
|
123
|
+
Style/EndlessMethod: # new in 1.8
|
|
124
|
+
Enabled: true
|
|
125
|
+
Style/EnvHome: # new in 1.29
|
|
126
|
+
Enabled: true
|
|
127
|
+
Style/ExactRegexpMatch: # new in 1.51
|
|
128
|
+
Enabled: true
|
|
129
|
+
Style/FetchEnvVar: # new in 1.28
|
|
130
|
+
Enabled: true
|
|
131
|
+
Style/FileEmpty: # new in 1.48
|
|
132
|
+
Enabled: true
|
|
133
|
+
Style/FileRead: # new in 1.24
|
|
134
|
+
Enabled: true
|
|
135
|
+
Style/RedundantEach: # new in 1.38
|
|
136
|
+
Enabled: true
|
|
137
|
+
Style/RedundantFilterChain: # new in 1.52
|
|
138
|
+
Enabled: true
|
|
139
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
|
140
|
+
Enabled: true
|
|
141
|
+
Style/RedundantInitialize: # new in 1.27
|
|
142
|
+
Enabled: true
|
|
143
|
+
Style/RedundantLineContinuation: # new in 1.49
|
|
144
|
+
Enabled: true
|
|
145
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
|
146
|
+
Enabled: true
|
|
147
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
|
148
|
+
Enabled: true
|
|
149
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
|
150
|
+
Enabled: true
|
|
151
|
+
Style/RedundantStringEscape: # new in 1.37
|
|
152
|
+
Enabled: true
|
|
153
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
|
154
|
+
Enabled: true
|
|
155
|
+
Style/SelectByRegexp: # new in 1.22
|
|
156
|
+
Enabled: true
|
|
157
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
|
158
|
+
Enabled: true
|
|
159
|
+
Style/StringChars: # new in 1.12
|
|
160
|
+
Enabled: true
|
|
161
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
|
162
|
+
Enabled: true
|
|
163
|
+
Style/SwapValues: # new in 1.1
|
|
164
|
+
Enabled: true
|
|
165
|
+
Style/YAMLFileRead: # new in 1.53
|
|
166
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
## 0.2.0 - 2024-03-26
|
|
5
|
+
|
|
6
|
+
### Added
|
|
7
|
+
- Add methods to register new provider adapter
|
|
8
|
+
- Change cep word by zipcode to keep the same terminology
|
|
9
|
+
- Add simplecov to project CI build
|
|
10
|
+
- Add more ruby versions to CI build
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Remove wrong markdown code block tag from README
|
|
14
|
+
|
|
15
|
+
### Removed
|
|
16
|
+
- Remove rubocop check from rake default task
|
|
17
|
+
|
|
18
|
+
### Security
|
|
19
|
+
- Enable rubygems mfa requirement at gemspec file
|
|
20
|
+
|
|
21
|
+
|
|
3
22
|
## [0.1.0] - 2024-03-26
|
|
4
23
|
|
|
5
24
|
- Initial release
|
data/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Brazil::Cep
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/brazil-cep)
|
|
4
|
+
[](https://github.com/dvinciguerra/brazil-cep/actions/workflows/main.yml)
|
|
5
|
+
[](https://codeclimate.com/github/dvinciguerra/brazil-cep/maintainability)
|
|
6
|
+
[](https://codeclimate.com/github/dvinciguerra/brazil-cep/test_coverage)
|
|
7
|
+
|
|
3
8
|
This gem provides a simple way to validate and format Brazilian postal codes (CEP).
|
|
4
9
|
|
|
5
10
|
## Installation
|
|
@@ -62,7 +67,6 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/dvinci
|
|
|
62
67
|
## Code of Conduct
|
|
63
68
|
|
|
64
69
|
Everyone interacting in the Brazil::Cep project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dvinciguerra/brazil-cep/blob/master/CODE_OF_CONDUCT.md).
|
|
65
|
-
```
|
|
66
70
|
|
|
67
71
|
## License
|
|
68
72
|
|
data/Rakefile
CHANGED
|
@@ -5,8 +5,8 @@ require "rspec/core/rake_task"
|
|
|
5
5
|
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
|
7
7
|
|
|
8
|
-
require "rubocop/rake_task"
|
|
8
|
+
# require "rubocop/rake_task"
|
|
9
|
+
# RuboCop::RakeTask.new
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
task default: %i[spec rubocop]
|
|
11
|
+
# task default: %i[spec rubocop]
|
|
12
|
+
task default: %i[spec]
|
data/lib/brazil_cep/adapters.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Brazil
|
|
|
4
4
|
module Cep
|
|
5
5
|
# Adapters class namespace
|
|
6
6
|
module Adapters
|
|
7
|
+
# autoload default adapters
|
|
7
8
|
autoload :Base, "brazil_cep/adapters/base"
|
|
8
9
|
autoload :Viacep, "brazil_cep/adapters/viacep"
|
|
9
10
|
autoload :Postmon, "brazil_cep/adapters/postmon"
|
|
@@ -14,8 +15,30 @@ module Brazil
|
|
|
14
15
|
viacep: Viacep,
|
|
15
16
|
postmon: Postmon,
|
|
16
17
|
republica_virtual: RepublicaVirtual
|
|
17
|
-
}
|
|
18
|
+
}
|
|
18
19
|
|
|
20
|
+
private_constant :PROVIDERS
|
|
21
|
+
|
|
22
|
+
# get providers
|
|
23
|
+
# @return [Hash] providers
|
|
24
|
+
def self.providers
|
|
25
|
+
PROVIDERS
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# register a provider
|
|
29
|
+
#
|
|
30
|
+
# @example
|
|
31
|
+
# Brazil::Cep::Adapters.register(:custom_provider, Brazil::Cep::Adapters::CustomProvider)
|
|
32
|
+
#
|
|
33
|
+
# @param provider_key [Symbol] provider key
|
|
34
|
+
# @param provider_class [Class] provider class
|
|
35
|
+
def self.register(provider_key, provider_class)
|
|
36
|
+
PROVIDERS[provider_key] = provider_class
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# get provider instance
|
|
40
|
+
# @param provider [Symbol] provider key
|
|
41
|
+
# @return [Base] provider instance
|
|
19
42
|
def self.get(provider = :viacep)
|
|
20
43
|
PROVIDERS[provider].new
|
|
21
44
|
end
|
data/lib/brazil_cep/address.rb
CHANGED
|
@@ -4,10 +4,10 @@ module Brazil
|
|
|
4
4
|
module Cep
|
|
5
5
|
# Address class
|
|
6
6
|
class Address
|
|
7
|
-
attr_reader :
|
|
7
|
+
attr_reader :zipcode, :state, :city, :neighborhood, :street, :complement, :meta
|
|
8
8
|
|
|
9
9
|
def initialize(**arguments)
|
|
10
|
-
@
|
|
10
|
+
@zipcode = arguments[:zipcode]
|
|
11
11
|
@state = arguments[:state]
|
|
12
12
|
@city = arguments[:city]
|
|
13
13
|
@neighborhood = arguments[:neighborhood]
|
data/lib/brazil_cep/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brazil-cep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Vinciguerra
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-03-
|
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Brazil::CEP is a gem to provide interface to use common CEP services
|
|
14
14
|
email:
|
|
@@ -38,6 +38,7 @@ homepage: https://github.com/dvinciguerra/brazil-cep
|
|
|
38
38
|
licenses:
|
|
39
39
|
- MIT
|
|
40
40
|
metadata:
|
|
41
|
+
rubygems_mfa_required: 'true'
|
|
41
42
|
homepage_uri: https://github.com/dvinciguerra/brazil-cep
|
|
42
43
|
source_code_uri: https://github.com/dvinciguerra/brazil-cep
|
|
43
44
|
changelog_uri: https://github.com/dvinciguerra/brazil-cep
|