Class: Fog::DigitalOcean::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/digitalocean/service.rb

Instance Method Summary collapse

Instance Method Details

#request(params, parse_json = true) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/digitalocean/service.rb', line 5

def request(params, parse_json = true)
  first_attempt = true
  begin
    response = @connection.request(request_params(params))
  rescue Excon::Errors::Unauthorized => error
    raise error unless first_attempt
    first_attempt = false
    authenticate
    retry
  end

  process_response(response) if parse_json
  response
end