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
24 25 26 |
# File 'lib/netbox_client_ruby/connection.rb', line 24 def self.auth_config netbox_config.auth end |
.headers ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/netbox_client_ruby/connection.rb', line 16 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
28 29 30 |
# File 'lib/netbox_client_ruby/connection.rb', line 28 def self.netbox_config NetboxClientRuby.config.netbox end |
.new(options = {}) ⇒ Object
12 13 14 |
# File 'lib/netbox_client_ruby/connection.rb', line 12 def self.new( = {}) build_faraday(DEFAULT_OPTIONS.merge()) end |