Class: Wesabe::Credential
- Defined in:
- lib/wesabe/credential.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
The accounts linked to this credential.
-
#financial_institution ⇒ Object
The financial institution this credential is for.
-
#id ⇒ Object
The id of the credential, used to identify the account in URLs.
Attributes inherited from BaseModel
Class Method Summary collapse
-
.from_xml(xml) ⇒ Wesabe::Credential
Returns a
Wesabe::Credential
generated from Wesabe’s API XML.
Instance Method Summary collapse
-
#initialize {|credential| ... } ⇒ Credential
constructor
Initializes a
Wesabe::Credential
and yields itself. - #inspect ⇒ Object
-
#start_job ⇒ Wesabe::Job
Starts a new sync job for this
Wesabe::Credential
.
Methods inherited from BaseModel
Methods included from Util
Constructor Details
#initialize {|credential| ... } ⇒ Credential
Initializes a Wesabe::Credential
and yields itself.
13 14 15 |
# File 'lib/wesabe/credential.rb', line 13 def initialize yield self if block_given? end |
Instance Attribute Details
#accounts ⇒ Object
The accounts linked to this credential.
7 8 9 |
# File 'lib/wesabe/credential.rb', line 7 def accounts @accounts end |
#financial_institution ⇒ Object
The financial institution this credential is for.
5 6 7 |
# File 'lib/wesabe/credential.rb', line 5 def financial_institution @financial_institution end |
#id ⇒ Object
The id of the credential, used to identify the account in URLs.
3 4 5 |
# File 'lib/wesabe/credential.rb', line 3 def id @id end |
Class Method Details
.from_xml(xml) ⇒ Wesabe::Credential
Returns a Wesabe::Credential
generated from Wesabe’s API XML.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/wesabe/credential.rb', line 32 def self.from_xml(xml) new do |cred| cred.id = xml.at('id').inner_text.to_i cred.financial_institution = Wesabe::FinancialInstitution.from_xml( xml.children_of_type('financial-institution')[0]) cred.accounts = xml.search('accounts account').map do |account| Wesabe::Account.from_xml(account) end end end |
Instance Method Details
#inspect ⇒ Object
43 44 45 |
# File 'lib/wesabe/credential.rb', line 43 def inspect inspect_these :id, :financial_institution, :accounts end |
#start_job ⇒ Wesabe::Job
Starts a new sync job for this Wesabe::Credential
.
21 22 23 |
# File 'lib/wesabe/credential.rb', line 21 def start_job associate(Wesabe::Job.from_xml(Hpricot::XML(post(:url => "/credentials/#{id}/jobs.xml")) / :job)) end |