Class: Mbanker::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/mbanker/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index, crawler, attributes) ⇒ Account

Returns a new instance of Account.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mbanker/account.rb', line 6

def initialize index, crawler, attributes
  @index, @crawler = index, crawler
  if attributes.key? :full_name_and_number
    extract_label_name_and_number attributes[:full_name_and_number]
  end
  [:balance, :available_money].each do |attribute_name|
    if attributes.key? attribute_name
      instance_variable_set(:"@#{attribute_name}", attributes[attribute_name])
    end
  end
end

Instance Attribute Details

#account_typeObject (readonly)

Returns the value of attribute account_type.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def 
  @account_type
end

#available_moneyObject (readonly)

Returns the value of attribute available_money.



4
5
6
# File 'lib/mbanker/account.rb', line 4

def available_money
  @available_money
end

#balanceObject (readonly)

Returns the value of attribute balance.



4
5
6
# File 'lib/mbanker/account.rb', line 4

def balance
  @balance
end

#bic_numberObject (readonly)

Returns the value of attribute bic_number.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def bic_number
  @bic_number
end

#client_roleObject (readonly)

Returns the value of attribute client_role.



4
5
6
# File 'lib/mbanker/account.rb', line 4

def client_role
  @client_role
end

#iban_numberObject (readonly)

Returns the value of attribute iban_number.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def iban_number
  @iban_number
end

#indexObject (readonly)

Returns the value of attribute index.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def index
  @index
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/mbanker/account.rb', line 3

def number
  @number
end

#ownerObject (readonly)

Returns the value of attribute owner.



4
5
6
# File 'lib/mbanker/account.rb', line 4

def owner
  @owner
end

#plenipotentiaryObject (readonly)

Returns the value of attribute plenipotentiary.



4
5
6
# File 'lib/mbanker/account.rb', line 4

def plenipotentiary
  @plenipotentiary
end

Instance Method Details

#change_name(new_name) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/mbanker/account.rb', line 18

def change_name new_name
  
  @crawler.click change_name_button
  
  @crawler.get_form.tbVarPartAccName = new_name
  @crawler.click confirm_button
end

#fetch_detailsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mbanker/account.rb', line 26

def fetch_details
   
  extract_label_and_name @crawler.extract_text('fieldset:nth-child(2) .content')
  @number = @crawler.extract_text('fieldset:nth-child(3) .content')
  @iban_number = @crawler.extract_text('fieldset:nth-child(4) .content')
  @bic_number = @crawler.extract_text('fieldset:nth-child(5) .content')
  @account_type = @crawler.extract_text('fieldset:nth-child(6) .content')
  @owner = @crawler.extract_text('fieldset:nth-child(7) li')
  @plenipotentiary = @crawler.extract_text('fieldset:nth-child(8) li')
  @client_role = @crawler.extract_text('fieldset:nth-child(9) .content')
  @balance = @crawler.extract_text('fieldset:nth-child(10) .amount')
  @available_money = @crawler.extract_text('fieldset:nth-child(11) .amount')
end