Class: EnomAPI::Interface
- Inherits:
-
Object
- Object
- EnomAPI::Interface
- Defined in:
- lib/enom-api/interface.rb
Overview
Interface proxy for the eNom Reseller API
Constant Summary collapse
- VERSION =
Version of the Interface class, sent with the HTTP requests
'0.1.0'
Instance Method Summary collapse
-
#initialize(user, passwd, server = 'reseller.enom.com') ⇒ Interface
constructor
A new instance of Interface.
-
#method_missing(meth, options = {}) ⇒ String
XML Body of the response.
-
#search {|q| ... } ⇒ String
XML Body of the Search Query results.
Constructor Details
#initialize(user, passwd, server = 'reseller.enom.com') ⇒ Interface
Returns a new instance of Interface.
12 13 14 15 |
# File 'lib/enom-api/interface.rb', line 12 def initialize(user, passwd, server = 'reseller.enom.com') @user, @passwd = user, passwd @uri = URI.parse('https://%s/interface.asp' % server) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, options = {}) ⇒ String
Returns XML Body of the response.
28 29 30 |
# File 'lib/enom-api/interface.rb', line 28 def method_missing(meth, = {}) send_request(.merge(:command => meth.to_s, :responseType => 'xml')) end |
Instance Method Details
#search {|q| ... } ⇒ String
Returns XML Body of the Search Query results.
20 21 22 23 |
# File 'lib/enom-api/interface.rb', line 20 def search q = yield SearchQuery.new send_request(q.to_post_data) end |