Skip to content

Instantly share code, notes, and snippets.

@thesp0nge
Last active January 4, 2016 16:29
Show Gist options
  • Select an option

  • Save thesp0nge/8647443 to your computer and use it in GitHub Desktop.

Select an option

Save thesp0nge/8647443 to your computer and use it in GitHub Desktop.
SecurePass API ping example
require 'net/http'
require 'net/https'
require 'json'
ENDPOINT = "https://beta.secure-pass.net/api/v1/ping"
APP_ID = "your_id"
APP_SECRET = "your_secret"
uri = URI.parse(ENDPOINT)
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE if https.use_ssl?
req = Net::HTTP::Post.new(uri.path)
req.add_field("X-SecurePass-App-ID", APP_ID)
req.add_field("X-SecurePass-App-Secret", APP_SECRET)
res = https.request(req)
parsed = JSON.parse(res.body)
puts "called from #{parsed["ip"]} with ip_version = #{parsed["ip_version"]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment