Class: Abiraj::Init
- Inherits:
-
Object
- Object
- Abiraj::Init
- Defined in:
- lib/abiraj.rb
Instance Method Summary collapse
-
#initialize(server_url:, authtoken:, org: nil, certificate: nil) ⇒ Init
constructor
A new instance of Init.
Constructor Details
#initialize(server_url:, authtoken:, org: nil, certificate: nil) ⇒ Init
Returns a new instance of Init.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/abiraj.rb', line 28 def initialize(server_url:, authtoken:, org: nil, certificate: nil) if server_url.nil? || authtoken.nil? || server_url.strip.empty? || authtoken.strip.empty? Abiraj.log(message: "Server URL and authtoken are required to initialize Abiraj", level: "error") return nil end unless server_url.start_with?("http://", "https://") Abiraj.log(message: "Invalid server URL. It must start with http:// or https://", level: "error") return nil end Abiraj.server_url = server_url.strip Abiraj.authtoken = authtoken.strip Abiraj.org = org unless org.to_s.strip.empty? || org.nil? Abiraj.certificate = certificate Abiraj.log(message: "Abiraj initialized successfully") end |