Class: Gandi::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/gandi/connection.rb

Constant Summary collapse

SSL_VERIFY_MODE =
OpenSSL::SSL::VERIFY_NONE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apikey, url) ⇒ Connection

Returns a new instance of Connection.

Raises:



19
20
21
22
23
24
# File 'lib/gandi/connection.rb', line 19

def initialize(apikey, url)
  raise DataError, "You must set the apikey before calling any method" unless apikey
  @apikey = apikey
  @url = url
  connect
end

Instance Attribute Details

#apikeyObject (readonly)

The 24-character API key used for authentication.



14
15
16
# File 'lib/gandi/connection.rb', line 14

def apikey
  @apikey
end

#urlObject (readonly)

URL used for connecting to the Gandi API.



17
18
19
# File 'lib/gandi/connection.rb', line 17

def url
  @url
end

Instance Method Details

#call(method, *arguments) ⇒ Object

Calls a RPC method, automatically setting the apikey as the first argument.



27
28
29
# File 'lib/gandi/connection.rb', line 27

def call(method, *arguments)
  raw_call(method.to_s, @apikey, *arguments)
end