Class: Api::Activation

Inherits:
Billing show all
Defined in:
lib/api/activation.rb

Overview

This class executes an HTTP call to the API in billing, when the node is started for the first time. As a result of activation if receives an auth key, which is used for signing all subsequent API calls.

Constant Summary collapse

PKI_PATH =
'/hooks/pki/keys'

Constants inherited from Billing

Billing::KEY_PATH

Instance Method Summary collapse

Methods inherited from Billing

#api_call_result, #auth_key, #host_with_port, #hostname, #response, #success_api_call?, #uri

Instance Method Details

#activateObject



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

def activate
  return if active_node?

  if activated_successfully?
    save_auth_key
  else
    raise "Can't activate server at billing"
  end
end