Class: Wesabe::FinancialInstitution

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/wesabe/financial_institution.rb

Instance Attribute Summary collapse

Attributes inherited from BaseModel

#wesabe

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#get, #post

Methods included from Util

#all_or_one

Constructor Details

#initialize {|financial_institution| ... } ⇒ FinancialInstitution

Initializes a Wesabe::FinancialInstitution and yields itself.

Yield Parameters:



15
16
17
# File 'lib/wesabe/financial_institution.rb', line 15

def initialize
  yield self if block_given?
end

Instance Attribute Details

#homepage_urlObject

The home url of this FinancialInstitution.



9
10
11
# File 'lib/wesabe/financial_institution.rb', line 9

def homepage_url
  @homepage_url
end

#idObject

The id of this FinancialInstitution, as used in URLs.



3
4
5
# File 'lib/wesabe/financial_institution.rb', line 3

def id
  @id
end

#login_urlObject

The url users of this FinancialInstitution log in to for online banking.



7
8
9
# File 'lib/wesabe/financial_institution.rb', line 7

def 
  @login_url
end

#nameObject

The name of this FinancialInstitution (“Bank of America”).



5
6
7
# File 'lib/wesabe/financial_institution.rb', line 5

def name
  @name
end

Class Method Details

.from_xml(xml) ⇒ Wesabe::FinancialInstitution

Returns a Wesabe::FinancialInstitution generated from Wesabe’s API XML.

Parameters:

  • xml (Hpricot::Element)

    The <financial-institution> element from the API.

Returns:



26
27
28
29
30
31
32
33
# File 'lib/wesabe/financial_institution.rb', line 26

def self.from_xml(xml)
  new do |fi|
    fi.id = (xml.children_of_type("id") + xml.children_of_type("wesabe-id")).first.inner_text
    fi.name = xml.at("name").inner_text
    fi. = xml.at("login-url") && xml.at("login-url").inner_text
    fi.homepage_url = xml.at("homepage-url") && xml.at("homepage-url").inner_text
  end
end

Instance Method Details

#inspectObject



35
36
37
# File 'lib/wesabe/financial_institution.rb', line 35

def inspect
  inspect_these :id, :name
end