Class: Banker::BarclaycardUK

Inherits:
Base
  • Object
show all
Defined in:
lib/banker/barclaycard_uk.rb

Overview

This class allows the retrieval of account data for Barcalycard UK

Examples

Get OFX from Barcalycard UK

bank = Banker::BarcalycardUK.new(:username => "joe"
:password => '123456',
:memorable_word => 'superduper')

bank.accounts.first.balance #=> 410010

Constant Summary collapse

LOGIN_ENDPOINT =
'https://bcol.barclaycard.co.uk/ecom/as2/initialLogon.do'
EXPORT_ENDPOINT =
'https://bcol.barclaycard.co.uk/ecom/as2/export.do?doAction=processRecentExportTransaction&type=OFX_2_0_2&statementDate=&sortBy=transactionDate&sortType=Dsc'
FIELDS =
{
  username: 'username',
  password: 'password',
  memorable_word: [
    'firstAnswer',
    'secondAnswer'
  ]
}

Instance Attribute Summary collapse

Attributes inherited from Base

#agent, #keys

Instance Method Summary collapse

Methods inherited from Base

#class_name, #cleaner, #get, #get_letter, #memorable_required, #params, #parse_ofx

Constructor Details

#initialize(args = {}) ⇒ BarclaycardUK

Returns a new instance of BarclaycardUK.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/banker/barclaycard_uk.rb', line 29

def initialize(args = {})
  @keys = [:username, :password, :memorable_word]
  params(args)
  @username = args[:username]
  @password = args[:password]
  @memorable_word = args[:memorable_word]

  @accounts = []

  authenticate!

  get_data
  parse_ofx('credit_card')
end

Instance Attribute Details

#accountsObject

Returns the value of attribute accounts.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def accounts
  @accounts
end

#memorable_wordObject

Returns the value of attribute memorable_word.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def memorable_word
  @memorable_word
end

#ofxObject

Returns the value of attribute ofx.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def ofx
  @ofx
end

#pageObject

Returns the value of attribute page.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def page
  @page
end

#passwordObject

Returns the value of attribute password.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def password
  @password
end

#usernameObject

Returns the value of attribute username.



16
17
18
# File 'lib/banker/barclaycard_uk.rb', line 16

def username
  @username
end