ceplivre 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ module CepLivre
8
8
  include HTTParty
9
9
 
10
10
  def self.find(cep, format)
11
- self.get("http://ceplivre.com.br/consultar/cep/#{CepLivre::Configuration.key}/#{cep}/#{format}")
11
+ self.get("http://ceplivre.com.br/consultar/cep/#{CepLivre::Configuration.key}/#{cep}/#{format}")["cep"]
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Ceplivre
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,8 +7,14 @@ describe "CepLivre" do
7
7
  end
8
8
 
9
9
  describe "find_cep" do
10
- it "should get data from cep livre api" do
11
- CepLivre::Cep.find("22031-030", :json).should == {"cep"=>[{"tp_logradouro"=>"Rua", "tp_logradouro_id"=>"11", "logradouro"=>"Silva Castro", "bairro"=>"Copacabana", "cidade"=>"Rio de Janeiro", "uf_sigla"=>"RJ", "ufnome"=>"Rio de Janeiro", "id_estado_ibge"=>"33", "cep"=>"22031-030", "muncoddv"=>"3304557", "ddd"=>"21", "altitude"=>"2", "latitude"=>"-22.903", "longitude"=>"-43.208", "area"=>"1182.296", "capital"=>"S"}]}
10
+ context "json format" do
11
+ it "should get data from cep livre api" do
12
+ CepLivre::Cep.find("22031-030", :json).should == [{"tp_logradouro"=>"Rua", "tp_logradouro_id"=>"11", "logradouro"=>"Silva Castro", "bairro"=>"Copacabana", "cidade"=>"Rio de Janeiro", "uf_sigla"=>"RJ", "ufnome"=>"Rio de Janeiro", "id_estado_ibge"=>"33", "cep"=>"22031-030", "muncoddv"=>"3304557", "ddd"=>"21", "altitude"=>"2", "latitude"=>"-22.903", "longitude"=>"-43.208", "area"=>"1182.296", "capital"=>"S"}]
13
+ end
14
+
15
+ it "should return a empty array when not find a cep" do
16
+ CepLivre::Cep.find("12345-000", :json).should == []
17
+ end
12
18
  end
13
19
  end
14
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ceplivre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70274133829040 !ruby/object:Gem::Requirement
16
+ requirement: &70235357325820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70274133829040
24
+ version_requirements: *70235357325820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70274133828120 !ruby/object:Gem::Requirement
27
+ requirement: &70235357323480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70274133828120
35
+ version_requirements: *70235357323480
36
36
  description: Utilize a API ceplivre na sua aplicação
37
37
  email:
38
38
  - eduardofiorezi@gmail.com