Skip to content

Instantly share code, notes, and snippets.

@rboyd
Created August 8, 2012 05:04
Show Gist options
  • Save rboyd/3292230 to your computer and use it in GitHub Desktop.
Save rboyd/3292230 to your computer and use it in GitHub Desktop.
namecheap api via httparty
require 'yaml'
require 'httparty'
settings = YAML::load_file(File.dirname(File.expand_path(__FILE__)) + '/namecheap.yml')
username = settings['namecheap']['user']
api_key = settings['namecheap']['api_key']
request_string = "https://api.namecheap.com/xml.response"
command = 'namecheap.domains.dns.getEmailForwarding'
ip_addr = ''
domain = ''
options = { query: { ApiUser: username,
UserName: username,
ApiKey: api_key,
Command: command,
ClientIp: ip_addr,
DomainName: domain } }
res = HTTParty.get request_string, options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment