Class: Assertiva::Localize

Inherits:
Object
  • Object
show all
Defined in:
lib/assertiva/localize.rb

Class Method Summary collapse

Class Method Details

.pathsObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/assertiva/localize.rb', line 3

def self.paths
  paths = {
    by_cpf: "/v1/localize/1000/consultar",
    by_cnpj: "/v1/localize/1001/consultar",
    by_phone: "/v1/localize/1002/consultar",
    by_email: "/v1/localize/1003/consultar",
    by_name_or_address: "/v1/localize/1004/consultar",
    related_by_cpf: "/v1/localize/1005/consultar"
  }
end

.query_by_cnpj(cnpj) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/assertiva/localize.rb', line 22

def self.query_by_cnpj(cnpj)
  begin
    Requests.post(self.paths[:by_cnpj] + "?cnpj=#{cnpj}")
  rescue => e
    raise
  end
end

.query_by_cpf(cpf) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/assertiva/localize.rb', line 14

def self.query_by_cpf(cpf)
  begin
    Requests.post(self.paths[:by_cpf] + "?cpf=#{cpf}")
  rescue => e
    raise
  end
end

.query_by_name_or_address(query_params) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/assertiva/localize.rb', line 30

def self.query_by_name_or_address(query_params)
  begin
    Requests.post(self.paths[:by_name_or_address], query_params)
  rescue => e
    raise
  end
end