Module: ProviderDSL::GandiProxy

Included in:
Gandi::ProxyCall
Defined in:
lib/provider_dsl/gandi_proxy.rb

Constant Summary collapse

LIMITER =

Gandi allow 30 calls to their API every 2 seconds - doc.rpc.gandi.net/overview.html#rate-limit To be safe we’ll limit calls to no more than 20 every 2 seconds

RateLimiter.new(20, 2)

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/provider_dsl/gandi_proxy.rb', line 11

def method_missing(method, *arguments)
  result = super(method, *arguments)
  method_name = chained.join('.')
  return result unless ::Gandi::VALID_METHODS.include?(method_name)
  Log.instance.debug((["-> Gandi #{method_name}"] + [*arguments]).join("\n  "))
  Log.instance.debug("Result:\n#{result}")
  LIMITER.wait
  result
end