module BOS

Constants

LOGIN_PAGE
VERSION

Attributes

password[R]
security_code[R]
user_id[R]

Public Class Methods

agent() click to toggle source
# File lib/bos.rb, line 11
def agent
  @agent ||= begin
    a = Mechanize.new
    a.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    a
  end
end
client() click to toggle source

Public: The client that answer your questions about your banking

Returns: A BOS::User object

# File lib/bos.rb, line 42
def client
  @client ||= begin
    config(file: true) if !user_id
    User.new(user_id, password, security_code)
  end
end
config(options = {}) click to toggle source

Public: Configure the user_id, password and security code

Return: Nothing

# File lib/bos.rb, line 22
def config(options = {})
  if options[:file]
    filename = options[:filename] || File.join(Dir.home, ".bos")
    config_hash = JSON.parse(IO.read(filename), symbolize_names: true)
    @user_id = config_hash[:user_id]
    @password = config_hash[:password]
    @security_code = config_hash[:security_code]
  else
    @user_id = options[:user_id]
    @password = options[:password]
    @security_code = options[:security_code]
    File.open(File.join(Dir.home, ".bos"), "w") do |f|
      f.write options.to_json
    end
  end
end