Module: Windoo::Connection::Attributes
- Included in:
- Windoo::Connection
- Defined in:
- lib/windoo/connection/attributes.rb
Overview
This module defines general attributes of a connection object
These attributes actually come from the token:
base_url, host, port, user, keep_alive?, ssl_version,
verify_cert?, pw_fallback
There are convience getters defined for them below
Instance Attribute Summary collapse
-
#cnx ⇒ Faraday::Connection
readonly
The underlying connection object.
-
#connect_time ⇒ Time
(also: #login_time)
readonly
When this connection was connected.
-
#connected ⇒ Boolean
(also: #connected?)
readonly
Are we connected right now?.
-
#last_http_response ⇒ Faraday::Response
readonly
The response from the most recent API call.
-
#name ⇒ String
The name of this connection, an arbitrary string.
-
#open_timeout ⇒ Integer
Seconds before an http connection open times out.
-
#timeout ⇒ Integer
Seconds before an http request times out.
-
#token ⇒ Windoo::Connection::Token
readonly
The token used for connecting.
Class Method Summary collapse
Instance Method Summary collapse
-
#base_url ⇒ URI::HTTPS
The base URL to the server.
-
#host ⇒ String
(also: #server, #hostname)
The hostname of the Jamf Pro server API connection.
-
#keep_alive? ⇒ Boolean
Is the connection token being automatically refreshed?.
-
#port ⇒ Integer
The port of the Jamf Pro server API connection.
-
#pw_fallback? ⇒ Boolean
If keep_alive is true, is the password Cached in memory to use if the refresh fails?.
-
#ssl_options ⇒ Hash
The ssl version and verify cert, to pass into faraday connections.
-
#ssl_version ⇒ String
SSL version used for the connection.
-
#user ⇒ String
The username who’s connected to the JSS API.
-
#validate_connection ⇒ void
raise an error if no token yet.
-
#verify_cert? ⇒ Boolean
(also: #verify_cert)
Should the SSL certifcate from the server be verified?.
Instance Attribute Details
#cnx ⇒ Faraday::Connection (readonly)
Returns The underlying connection object.
46 47 48 |
# File 'lib/windoo/connection/attributes.rb', line 46 def cnx @cnx end |
#connect_time ⇒ Time (readonly) Also known as: login_time
Returns when this connection was connected.
42 43 44 |
# File 'lib/windoo/connection/attributes.rb', line 42 def connect_time @connect_time end |
#connected ⇒ Boolean (readonly) Also known as: connected?
Returns are we connected right now?.
49 50 51 |
# File 'lib/windoo/connection/attributes.rb', line 49 def connected @connected end |
#last_http_response ⇒ Faraday::Response (readonly)
Returns The response from the most recent API call.
39 40 41 |
# File 'lib/windoo/connection/attributes.rb', line 39 def last_http_response @last_http_response end |
#name ⇒ String
Returns the name of this connection, an arbitrary string.
27 28 29 |
# File 'lib/windoo/connection/attributes.rb', line 27 def name @name end |
#open_timeout ⇒ Integer
Returns Seconds before an http connection open times out.
33 34 35 |
# File 'lib/windoo/connection/attributes.rb', line 33 def open_timeout @open_timeout end |
#timeout ⇒ Integer
Returns Seconds before an http request times out.
30 31 32 |
# File 'lib/windoo/connection/attributes.rb', line 30 def timeout @timeout end |
#token ⇒ Windoo::Connection::Token (readonly)
Returns the token used for connecting.
36 37 38 |
# File 'lib/windoo/connection/attributes.rb', line 36 def token @token end |
Class Method Details
.included(includer) ⇒ Object
22 23 24 |
# File 'lib/windoo/connection/attributes.rb', line 22 def self.included(includer) Windoo.verbose_include(includer, self) end |
Instance Method Details
#base_url ⇒ URI::HTTPS
Returns the base URL to the server.
89 90 91 92 |
# File 'lib/windoo/connection/attributes.rb', line 89 def base_url validate_connection @token&.base_url end |
#host ⇒ String Also known as: server, hostname
Returns the hostname of the Jamf Pro server API connection.
95 96 97 98 |
# File 'lib/windoo/connection/attributes.rb', line 95 def host validate_connection @token&.host end |
#keep_alive? ⇒ Boolean
Returns Is the connection token being automatically refreshed?.
115 116 117 118 |
# File 'lib/windoo/connection/attributes.rb', line 115 def keep_alive? validate_connection @token&.keep_alive? end |
#port ⇒ Integer
Returns The port of the Jamf Pro server API connection.
103 104 105 106 |
# File 'lib/windoo/connection/attributes.rb', line 103 def port validate_connection @token&.port end |
#pw_fallback? ⇒ Boolean
Returns If keep_alive is true, is the password Cached in memory to use if the refresh fails?.
122 123 124 125 |
# File 'lib/windoo/connection/attributes.rb', line 122 def pw_fallback? validate_connection @token&.pw_fallback? end |
#ssl_options ⇒ Hash
Returns the ssl version and verify cert, to pass into faraday connections.
141 142 143 144 |
# File 'lib/windoo/connection/attributes.rb', line 141 def validate_connection @token&. end |
#ssl_version ⇒ String
Returns SSL version used for the connection.
128 129 130 131 |
# File 'lib/windoo/connection/attributes.rb', line 128 def ssl_version validate_connection @token&.ssl_version end |
#user ⇒ String
Returns the username who’s connected to the JSS API.
109 110 111 112 |
# File 'lib/windoo/connection/attributes.rb', line 109 def user validate_connection @token&.user end |
#validate_connection ⇒ void
This method returns an undefined value.
raise an error if no token yet
148 149 150 |
# File 'lib/windoo/connection/attributes.rb', line 148 def validate_connection raise Windoo::NotConnectedError, 'Not connected, use #connect first' unless connected? end |
#verify_cert? ⇒ Boolean Also known as: verify_cert
Returns Should the SSL certifcate from the server be verified?.
134 135 136 137 |
# File 'lib/windoo/connection/attributes.rb', line 134 def verify_cert? validate_connection @token&.verify_cert? end |