module Everyoneapi
Constants
- API_ENDPOINT
- API_VERSION
- VERSION
Public Class Methods
person(phone_number,data=nil)
click to toggle source
# File lib/everyoneapi.rb, line 12 def person(phone_number,data=nil) options = {} options[:data] = data || "name,address" options[:account_sid] = ENV['EVERYONEAPI_SID'] options[:auth_token] = ENV['EVERYONEAPI_TOKEN'] url = [API_ENDPOINT, API_VERSION,"phone",phone_number.strip].join("/") uri = URI.parse(url) uri.query = URI.encode_www_form(options) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) res = http.request(request) raise RuntimeError.new res.message unless res.kind_of? Net::HTTPOK return Person.new JSON.parse(res.body,:symbolize_names => true) end
Private Instance Methods
person(phone_number,data=nil)
click to toggle source
# File lib/everyoneapi.rb, line 12 def person(phone_number,data=nil) options = {} options[:data] = data || "name,address" options[:account_sid] = ENV['EVERYONEAPI_SID'] options[:auth_token] = ENV['EVERYONEAPI_TOKEN'] url = [API_ENDPOINT, API_VERSION,"phone",phone_number.strip].join("/") uri = URI.parse(url) uri.query = URI.encode_www_form(options) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) res = http.request(request) raise RuntimeError.new res.message unless res.kind_of? Net::HTTPOK return Person.new JSON.parse(res.body,:symbolize_names => true) end