Last active
January 4, 2016 16:29
-
-
Save thesp0nge/8647443 to your computer and use it in GitHub Desktop.
SecurePass API ping example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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