class PritunlApiClient::Client
Main interface to the Pritunl api
Public Class Methods
@param base_url [String] Full URL to a running Pritunl server (include the “https://”) @param api_token [String @param api_secret [String] @param verify_ssl [Boolean] Whether or not to verify SSL certificate
# File lib/pritunl_api_client.rb, line 24 def initialize( base_url:, api_token:, api_secret:, verify_ssl: true ) @base_url = base_url @api_token = api_token @api_secret = api_secret @verify_ssl = verify_ssl @api = Api.new( base_url: base_url, api_token: api_token, api_secret: api_secret, verify_ssl: verify_ssl ) end
Public Instance Methods
Get a list of events (will poll up to 30 seconds)
@param cursor [String, NilClass] Optional id of last event. If left out, only events
that occurred after request is sent will be returned.
@return [Array]
# File lib/pritunl_api_client.rb, line 37 def event( cursor: nil ) @api.get( "/event/#{cursor}" ) end
Key
apis
@return [PritunlApiClient::Key]
# File lib/pritunl_api_client.rb, line 90 def key @key ||= Key.new( @api ) end
Returns a list of server log entries
@return [Array]
# File lib/pritunl_api_client.rb, line 62 def log @api.get( '/log' ) end
Organization
apis
@return [PritunlApiClient::Organization]
# File lib/pritunl_api_client.rb, line 76 def organization @organization ||= Organization.new( @api ) end
Server
healthcheck
@return [Boolean]
# File lib/pritunl_api_client.rb, line 44 def ping begin @api.get( '/ping' ) == '' rescue false end end
Server
apis
@return [PritunlApiClient::Server]
# File lib/pritunl_api_client.rb, line 97 def server @server ||= Server.new( @api ) end
Setting apis
@return [PritunlApiClient::Settings]
# File lib/pritunl_api_client.rb, line 69 def settings @settings ||= Settings.new( @api ) end
Returns general information about the pritunl server
@return [Hash]
# File lib/pritunl_api_client.rb, line 55 def status @api.get( '/status' ) end
User
apis
@return [PritunlApiClient::User]
# File lib/pritunl_api_client.rb, line 83 def user @user ||= User.new( @api ) end