cep_facil 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -7
- data/lib/cep_facil/version.rb +1 -1
- data/lib/cep_facil.rb +10 -10
- metadata +4 -4
data/README.md
CHANGED
@@ -9,14 +9,12 @@ Installation
|
|
9
9
|
In the `Gemfile`
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
|
13
|
-
gem `cep_facil`
|
14
|
-
|
12
|
+
gem "cep_facil"
|
15
13
|
```
|
16
14
|
|
17
15
|
Or via RubyGems, directly:
|
18
16
|
|
19
|
-
gem install cep_facil
|
17
|
+
`gem install cep_facil`
|
20
18
|
|
21
19
|
|
22
20
|
Usage
|
@@ -38,16 +36,21 @@ There are three formats for one to store Brazilian zip codes (CEPS):
|
|
38
36
|
|
39
37
|
* "12345-678"
|
40
38
|
* "12345678"
|
41
|
-
* 12345678 #
|
39
|
+
* 12345678 # I wouldn't use this one, really.
|
42
40
|
|
43
41
|
CepFácil works with the three of them.
|
44
42
|
|
45
|
-
|
43
|
+
Author
|
46
44
|
------
|
47
45
|
|
48
46
|
* Rodrigo Vieira - rodrigovieira1994@gmail.com - http://www.rodrigoalvesvieira.com
|
49
47
|
|
50
|
-
|
48
|
+
Thanks
|
49
|
+
-------
|
50
|
+
|
51
|
+
Huge thanks and cheers to CépFácil (http://cepfacil.com.br) of course. Thanks for the great service that you provide!
|
52
|
+
|
53
|
+
Licence
|
51
54
|
-------
|
52
55
|
|
53
56
|
Copyright (c) 2012 Rodrigo Vieira. http://www.rodrigoalvesvieira.com/
|
data/lib/cep_facil/version.rb
CHANGED
data/lib/cep_facil.rb
CHANGED
@@ -3,21 +3,21 @@ require "cep_facil/version"
|
|
3
3
|
require "net/http"
|
4
4
|
|
5
5
|
module CepFacil
|
6
|
-
|
7
|
-
#
|
8
|
-
#
|
6
|
+
|
7
|
+
# Receives the zip code (CEP) and the Token (get yours at http://cepfacil.com.br) and
|
8
|
+
# returns the address referent to that zip code as a hash object.
|
9
9
|
#
|
10
10
|
# == Exemplo
|
11
11
|
# require "cep_facil"
|
12
12
|
# cep = "5417-540"
|
13
13
|
# token = "1234567890"
|
14
|
-
# CepFacil.get_address(cep, token)
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
14
|
+
# address = CepFacil.get_address(cep, token)
|
15
|
+
# address is a hash with 6 keys: cep, type, state, city, neighborhood, description
|
16
|
+
# Reading them:
|
17
|
+
# address[:city]
|
18
|
+
# address[:state]
|
19
|
+
# Some applications store Brazilian zip codes (CEPs) in formats like "22222222", or "22222-222"
|
20
|
+
# or even as an integer. This method accept these three possible formats so you don´t need to format it yourself.
|
21
21
|
|
22
22
|
def self.get_address(zip_code, token)
|
23
23
|
zip_code = zip_code.to_s
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cep_facil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70231872781820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70231872781820
|
25
25
|
description: Wrapper Ruby para o serviço cepfacil.com.br
|
26
26
|
email:
|
27
27
|
- rodrigo@atela.com.br
|