Class: Igsearch::Person

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/igsearch/person.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apikey = Igsearch.apikey) ⇒ Person

BUG/PROBLEM: still need to .to_json to send json…



23
24
25
26
# File 'lib/igsearch/person.rb', line 23

def initialize(apikey=Igsearch.apikey)
  # this changes it for all instances
  self.class.default_params :apikey => apikey
end

Class Method Details

.count(criteria, options = {}) ⇒ Object



56
57
58
59
60
61
# File 'lib/igsearch/person.rb', line 56

def self.count(criteria, options={})
  response = post('/count', body: criteria.to_json)

  return response.parsed_response["MatchCount"] if response.success?
  handle_error response
end

.find(id, options = {}) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/igsearch/person.rb', line 32

def self.find(id, options={})

  response = get("/#{id}", options)

  return response.parsed_response if response.success?
  handle_error response
end

.hiObject



28
29
30
# File 'lib/igsearch/person.rb', line 28

def self.hi
  return "success #{Igsearch.apikey}"
end

.search(criteria, options = {}) ⇒ Object



40
41
42
43
44
45
# File 'lib/igsearch/person.rb', line 40

def self.search(criteria, options={})
  response = post('/search', :body => criteria.to_json)

  return response.parsed_response if response.success?
  handle_error response
end

.search_raw_address(raw_address, options = {}) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/igsearch/person.rb', line 47

def self.search_raw_address(raw_address, options={})
  p_address = StreetAddress::US.parse(raw_address)

  return [] if p_address.nil?

  address = self.render_parsed_address_to_api_format(p_address)
  self.search(address, options)
end