Class: BenchmarkEmailApi::Client
- Inherits:
-
Object
- Object
- BenchmarkEmailApi::Client
- Defined in:
- lib/benchmark_email_api.rb
Instance Method Summary collapse
-
#initialize(username, password, api_url) ⇒ Client
constructor
A new instance of Client.
- #method_missing(api_method, *args) ⇒ Object
Constructor Details
#initialize(username, password, api_url) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/benchmark_email_api.rb', line 9 def initialize(username,password,api_url) @server = XMLRPC::Client.new2(api_url) $ok, result = @server.call2('login', username, password) if $ok @token = result else puts "Error Code: #{result.faultCode}" puts "Error Description: #{result.faultString}" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(api_method, *args) ⇒ Object
19 20 21 22 |
# File 'lib/benchmark_email_api.rb', line 19 def method_missing(api_method, *args) $ok, result = @server.call2(api_method.to_s, @token, *args) return result end |