Sha256: 48a330e649df8e76b89a27db3cd9f66301708504a4424a5912dc15f2fbb26e99

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'brreg_grunndata'

# 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.

# (If you use this, don't forget to add pry to your Gemfile!)
require 'pry'

#
#  Easy access to a brreg client from within the console
#
# If you have  credentials set in ENV all you should need to do
# in the console is:
#
# client.hent_basisdata_mini orgnr: 'xyz' OR
# c.hent_basisdata_mini orgnr: 'xyz'
#
def client(debug: false, userid: nil, password: nil)
  config = {
    userid: userid || ENV['BRREG_USERNAME'],
    password: password || ENV['BRREG_PASSWORD']
  }

  if debug
    config[:logger] = Logger.new(STDOUT)
    config[:log_level] = :debug
  end

  BrregGrunndata::Client.new configuration: BrregGrunndata::Configuration.new(config)
end
alias c client

def service(debug: false, userid: nil, password: nil)
  BrregGrunndata::Service.new client: client(debug: debug, userid: userid, password: password)
end
alias s service

Pry.start

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
brreg_grunndata-0.1.7 bin/console
brreg_grunndata-0.1.6 bin/console
brreg_grunndata-0.1.5 bin/console
brreg_grunndata-0.1.4 bin/console
brreg_grunndata-0.1.3 bin/console
brreg_grunndata-0.1.2 bin/console
brreg_grunndata-0.1.1 bin/console
brreg_grunndata-0.1.0 bin/console