class EnomRuby::Client
Attributes
password[RW]
test?[RW]
test_mode[RW]
username[RW]
Public Class Methods
base_uri()
click to toggle source
Enom has a test platform and a production platform. Both are configured to use HTTPS at all times. Don't forget to configure permitted IPs (in both environments) or you'll get InterfaceErrors.
# File lib/enom-ruby/client.rb, line 25 def base_uri subdomain = test? ? 'resellertest' : 'reseller' "https://#{subdomain}.enom.com/interface.asp" end
configure() { |self| ... }
click to toggle source
# File lib/enom-ruby/client.rb, line 12 def configure yield self self end
default_params()
click to toggle source
All requests must contain the UID, PW, and ResponseType query parameters
# File lib/enom-ruby/client.rb, line 18 def default_params { "UID" => self.username, "PW" => self.password, "ResponseType" => "xml" } end
request(params = {})
click to toggle source
All requests to Enom are GET requests, even when we're changing data. Unfortunately, Enom also does not provide HTTP status codes to alert for authentication failures or other helpful statuses – everything comes back as a 200.
# File lib/enom-ruby/client.rb, line 33 def request(params = {}) response = get(base_uri, query: params.merge(default_params)) if Integer(response["interface_response"]["ErrCount"]).zero? return response["interface_response"] else raise response["interface_response"]["errors"].values.join(", ") end end