Class: Gandi::Session
- Inherits:
-
Object
show all
- Defined in:
- lib/gandi/session.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(api_key, options = {}) ⇒ Session
Returns a new instance of Session.
201
202
203
204
205
206
207
208
209
|
# File 'lib/gandi/session.rb', line 201
def initialize(api_key, options = {})
endpoint = options.is_a?(Hash) ? (ENDPOINT[options[:env]] || ENDPOINT[:production]) : options
@api_key = api_key
@server = XMLRPC::Client.new2(endpoint)
@server. = { "accept-encoding" => "identity" }
@server
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
223
224
225
226
227
|
# File 'lib/gandi/session.rb', line 223
def method_missing(method, *args)
ProxyCall.new(@server, self.api_key).send(method, *args)
rescue XMLRPC::FaultException => exception
raise(exception.faultCode < 500_000 ? Gandi::ServerError : Gandi::DataError, exception.faultString)
end
|
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
199
200
201
|
# File 'lib/gandi/session.rb', line 199
def api_key
@api_key
end
|
Instance Method Details
#list_methods ⇒ Object
211
212
213
|
# File 'lib/gandi/session.rb', line 211
def list_methods
server.call('system.listMethods')
end
|
#method_help(name) ⇒ Object
219
220
221
|
# File 'lib/gandi/session.rb', line 219
def method_help(name)
server.call('system.methodHelp', name)
end
|
#method_signature(name) ⇒ Object
215
216
217
|
# File 'lib/gandi/session.rb', line 215
def method_signature(name)
server.call('system.methodSignature', name)
end
|