ninech/netbox-client-ruby

View on GitHub
bin/console

Summary

Maintainability
Test Coverage
#!/usr/bin/env ruby

require 'bundler/setup'
require 'netbox-client-ruby'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

NetboxClientRuby.configure do |c|
  c.netbox.auth.token = '0123456789abcdef0123456789abcdef01234567'
  c.netbox.auth.rsa_private_key.path =
    File.expand_path('../netbox-client-ruby_rsa', __dir__)
  c.netbox.auth.rsa_private_key.password = nil
  c.netbox.api_base_url = "http://#{`docker-compose port nginx 8080`.strip}/api/"
  c.faraday.logger = :detailed_logger
end

NCR = NetboxClientRuby

version = File.read(File.expand_path('../VERSION', __dir__)).strip

puts <<~WELCOME_TEXT
  This is using NetboxClientRuby v#{version}.
  `NetboxClientRuby` has been abbreviated to `NCR` in this console.
  You will be talking to '#{NetboxClientRuby.config.netbox.api_base_url}'.

  Wondering how many regions you have in your Netbox?
  Type: NetboxClientRuby.dcim.regions.count
  Or Short: NCR.dcim.regions.count
WELCOME_TEXT

require 'pry'
Pry.start

# require 'irb'
# IRB.start(__FILE__)