Class: NetboxClientRuby::Connection
- Inherits:
-
Object
- Object
- NetboxClientRuby::Connection
- Defined in:
- lib/netbox_client_ruby/connection.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ request_encoding: :json }.freeze
Class Method Summary collapse
Class Method Details
.auth_config ⇒ Object
39 40 41 |
# File 'lib/netbox_client_ruby/connection.rb', line 39 def self.auth_config netbox_config.auth end |
.headers ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/netbox_client_ruby/connection.rb', line 31 def self.headers headers = {} auth_token = auth_config.token headers['Authorization'] = "Token #{auth_token}".freeze if auth_token headers['X-Session-Key'] = NetboxClientRuby::Secrets.session_key if NetboxClientRuby::Secrets.session_key headers end |
.netbox_config ⇒ Object
43 44 45 |
# File 'lib/netbox_client_ruby/connection.rb', line 43 def self.netbox_config NetboxClientRuby.config.netbox end |
.new(options = {}) ⇒ Object
27 28 29 |
# File 'lib/netbox_client_ruby/connection.rb', line 27 def self.new( = {}) build_faraday(**DEFAULT_OPTIONS.merge()) end |