Class: Wesabe::Model::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/wesabe/model/account.rb

Instance Attribute Summary

Attributes inherited from Base

#xml

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

configure, find_collection, #initialize, resource

Constructor Details

This class inherits a constructor from Wesabe::Model::Base

Class Method Details

.find(id) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/wesabe/model/account.rb', line 9

def self.find(id)
  case id
  when :all
    find_collection("/accounts", "//accounts/account")
  else
    super("/accounts/#{id}", "//account")
  end
end

Instance Method Details

#currencyObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/wesabe/model/account.rb', line 32

def currency
  node = get_node('./currency')
  @currency ||= {
    :symbol => node['symbol'],
    :delimiter => node['delimiter'],
    :separator => node['separator'],
    :decimal_places => node['decimal_places'],
    :type => node.content.to_s
  }
end

#institutionObject



28
29
30
# File 'lib/wesabe/model/account.rb', line 28

def institution
  @institution ||= Wesabe::Model::Institution.new(get_node('./financial-institution'))
end

#to_sObject



43
44
45
# File 'lib/wesabe/model/account.rb', line 43

def to_s
  self.id
end