Method: Dnsimple::Client#execute

Defined in:
lib/dnsimple/client.rb

#execute(method, path, data = nil, options = {}) ⇒ HTTParty::Response

Executes a request, validates and returns the response.

Raises:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/dnsimple/client.rb', line 156

def execute(method, path, data = nil, options = {})
  response = request(method, path, data, options)

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