Class: Dnsimple::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/record_store/provider/dnsimple/patch_api_header.rb

Instance Method Summary collapse

Instance Method Details

#execute(method, path, data = nil, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/record_store/provider/dnsimple/patch_api_header.rb', line 6

def execute(method, path, data = nil, options = {})
  response = request(method, path, data, options)
  rate_limit_sleep(response.headers['x-ratelimit-reset'].to_i, response.headers['x-ratelimit-remaining'].to_i)

  case response.code
  when 200..299
    response
  when 401
    raise AuthenticationFailed, response['message']
  when 404
    raise NotFoundError, response
  else
    raise RequestError, response
  end
end