Method: Libring::API#get_contact
- Defined in:
- lib/libring/api.rb
#get_contact(contact_code) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/libring/api.rb', line 51 def get_contact(contact_code) require "net/https" require "uri" require "json" uri = URI.parse("https://api.libring.com/v2/contact/get/" + contact_code.to_s) https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = true req = Net::HTTP::Get.new(uri.request_uri, initheader = {'Content-Type' =>'application/json', 'Authorization' => "Token #{@token}"}) resp = https.request(req) resp.body end |