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:



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

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.



9
10
11
# File 'lib/gandi/connection.rb', line 9

def apikey
  @apikey
end

#urlObject (readonly)

URL used for connecting to the Gandi API.



12
13
14
# File 'lib/gandi/connection.rb', line 12

def url
  @url
end

Instance Method Details

#call(method, *arguments) ⇒ Object

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



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

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