Class: BankApi::Clients::BancoSecurity::CompanyClient
- Inherits:
-
BankApi::Clients::BaseClient
- Object
- BankApi::Clients::BaseClient
- BankApi::Clients::BancoSecurity::CompanyClient
- Includes:
- Balance, Deposits, Login, Session, Transfers, Withdrawals, Navigation::BancoSecurity::CompanyNavigation
- Defined in:
- lib/bank_api/clients/banco_security/company_client.rb
Constant Summary
Constants included from Session
Constants included from Withdrawals
Constants included from Balance
Balance::ACCOUNT_NUMBER_COLUMN, Balance::AVAILABLE_BALANCE_COLUMN, Balance::COUNTABLE_BALANCE_COLUMN
Constants included from Navigation::BancoSecurity::CompanyNavigation
Navigation::BancoSecurity::CompanyNavigation::BASE_URL
Instance Method Summary collapse
- #bank_name ⇒ Object
- #execute_batch_transfers(transfers_data) ⇒ Object
- #execute_transfer(transfer_data) ⇒ Object
- #get_balance(options) ⇒ Object
- #get_deposits(options = {}) ⇒ Object
- #get_deposits_from_balance_section(account_number) ⇒ Object
- #get_deposits_from_transfers_section ⇒ Object
- #get_withdrawals ⇒ Object
- #goto_frame(query: nil, should_reset: true) ⇒ Object
-
#initialize(config = BankApi::Configuration.new) ⇒ CompanyClient
constructor
A new instance of CompanyClient.
Methods included from Session
#cookies, #session_headers, #setup_authentication
Methods included from Login
#click_login_button, #login, #set_login_values, #validate_credentials
Methods included from Transfers
#fill_coordinates, #set_transfer_transaction_data, #set_transfer_user_data, #submit_transfer_form, #validate_transfer_missing_data, #validate_transfer_valid_data
Methods included from Withdrawals
#account_number_variable, #any_withdrawals?, #fill_withdrawal_date_inputs, #format_withdrawal_transactions, #select_withdrawals_range, #total_withdrawals, #validate_withdrawals, #wait_for_withdrawals_fetch, #withdrawal_range, #withdrawals_from_json, #withdrawals_payload
Methods included from Deposits
#any_deposits?, #deposit_range, #deposits_account_details_url, #deposits_from_account_details, #deposits_from_txt, #deposits_txt_url, #extract_client_name, #fill_date_inputs, #format_account_transactions, #format_transactions, #select_deposits_range, #timezone, #wait_for_deposits_fetch
Methods included from Balance
#extract_balance, #find_account_balance, #get_balance_from_account_summary, #get_balance_from_accounts_list, #money_to_i, #validate_account_balance, #validate_summary_balance
Methods included from Navigation::BancoSecurity::CompanyNavigation
#goto_account_details, #goto_balance, #goto_company_dashboard, #goto_deposits, #goto_login, #goto_transfer_form, #goto_withdrawals, #session_expired?
Methods inherited from BankApi::Clients::BaseClient
#batch_transfers, #get_account_balance, #get_recent_deposits, #get_recent_withdrawals, #transfer
Constructor Details
#initialize(config = BankApi::Configuration.new) ⇒ CompanyClient
Returns a new instance of CompanyClient.
24 25 26 27 28 29 30 31 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 24 def initialize(config = BankApi::Configuration.new) @user_rut = config.banco_security.user_rut @password = config.banco_security.password @company_rut = config.banco_security.company_rut @dynamic_card = config.banco_security.dynamic_card @page_size = config.banco_security.page_size super end |
Instance Method Details
#bank_name ⇒ Object
33 34 35 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 33 def bank_name :security end |
#execute_batch_transfers(transfers_data) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 81 def execute_batch_transfers(transfers_data) login transfers_data.each do |transfer_data| goto_company_dashboard(transfer_data[:origin] || @company_rut) goto_transfer_form submit_transfer_form(transfer_data) fill_coordinates end ensure browser.close end |
#execute_transfer(transfer_data) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 71 def execute_transfer(transfer_data) login goto_company_dashboard(transfer_data[:origin] || @company_rut) goto_transfer_form submit_transfer_form(transfer_data) fill_coordinates ensure browser.close end |
#get_balance(options) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 37 def get_balance() login goto_company_dashboard([:rut] || @company_rut) goto_balance find_account_balance([:account_number]) ensure browser.close end |
#get_deposits(options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 46 def get_deposits( = {}) login goto_company_dashboard if [:source] == :account_details return get_deposits_from_balance_section([:account_number]) end get_deposits_from_transfers_section ensure browser.close end |
#get_deposits_from_balance_section(account_number) ⇒ Object
99 100 101 102 103 104 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 99 def get_deposits_from_balance_section(account_number) fail "missing :account_number option" unless account_number goto_balance goto_account_details(account_number.to_s) deposits_from_account_details end |
#get_deposits_from_transfers_section ⇒ Object
93 94 95 96 97 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 93 def get_deposits_from_transfers_section goto_deposits select_deposits_range deposits_from_txt end |
#get_withdrawals ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 59 def get_withdrawals login goto_company_dashboard goto_withdrawals select_withdrawals_range withdrawals = withdrawals_from_json validate_withdrawals(withdrawals) unless withdrawals.empty? withdrawals ensure browser.close end |
#goto_frame(query: nil, should_reset: true) ⇒ Object
106 107 108 109 110 |
# File 'lib/bank_api/clients/banco_security/company_client.rb', line 106 def goto_frame(query: nil, should_reset: true) sleep 1 super sleep 0.2 end |