#!/usr/bin/env ruby # frozen_string_literal: true require 'bundler/setup' require 'capital_on_tap' require 'date' require 'dotenv' Dotenv.load CapitalOnTap.configure do |config| config.client_id = ENV['CLIENT_ID'] config.client_secret = ENV['CLIENT_SECRET'] config.username = ENV['USERNAME'] config.password = ENV['PASSWORD'] config.debug = true end CapitalOnTap.setup_connection! TEST_PARAMS = { Salutation: 'Mr', FirstName: 'Roberto', LastName: 'Caras', DateOfBirth: Date.parse("1980-#{rand(1..12)}-#{rand(1..28)}"), MobilePhone: "077123456#{rand(11..99)}", EmailAddress: "oterosantos_#{rand(1..100)}@gmail.com", PersonalAddress: { CountryCode: 'UK', Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road", PostCode: 'BT12 6SQ', City: 'Belfast' }, TradingName: 'DUNDER MCMIFFLIN LTD', BusinessLegalName: 'DUNDER MCMIFFLIN LTD', BusinessLandline: '07874186570', YearsTrading: rand(1..10), MonthlyTurnOver: rand(300...9000), BusinessType: 'LimitedCompany', BusinessAddress: { CountryCode: 'UK', Street: "Unit #{rand(1..99)} Falcon Way Adelaide Industrial Estate, Boucher Road", PostCode: 'BT12 6SQ', City: 'Belfast' }, RegistrationNumber: 'NI644403' }.freeze def generate_code CapitalOnTap::Application.create(TEST_PARAMS) end require 'pry' Pry.start