lib/rails_whitepages.rb in rails_whitepages-0.1.2 vs lib/rails_whitepages.rb in rails_whitepages-0.1.3
- old
+ new
@@ -14,22 +14,39 @@
@api_key = api_key
@base_uri = "https://proapi.whitepages.com/"
end
def find_person(query)
- make_http_call(query, "person")
+ make_http_call(query, "person.json")
end
def reverse_phone(phone)
query["phone_number"] = phone
- make_http_call(query, "phone")
+ make_http_call(query, "phone.json")
end
-
+
+ def email_validation(email)
+ query = Hash.new
+ query["email_address"] = email
+ make_http_call(query, "identity_score/email_address_", "2.0")
+ end
+
+ def reverse_address(query)
+ make_http_call(query, "location.json")
+ end
+
+ def find_business(name,city)
+ query = Hash.new
+ query["name"] = name
+ query["city"] = city
+ make_http_call(query, "business.json")
+ end
+
private
- def make_http_call(request, endpoint)
+ def make_http_call(request, endpoint, api_version = @api_version)
request["api_key"] = @api_key
- url = URI.parse( @base_uri + @api_version + "/" + endpoint + ".json?" + request.to_query )
+ url = URI.parse( @base_uri + api_version + "/" + endpoint + "?" + request.to_query )
response = Net::HTTP.get( url )
return JSON.parse(response)
end
end
end