Class: Rippler::Account
- Inherits:
-
Object
- Object
- Rippler::Account
- Includes:
- Utils
- Defined in:
- lib/rippler/account.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#flags ⇒ Object
Returns the value of attribute flags.
Instance Method Summary collapse
-
#initialize(data) ⇒ Account
constructor
String: “evoorhees” or “rpfxDFsjDNtzSBCALKuWoWMkpRp4vxvgrG” Hash: “Balance”=>“199999990”, “Flags”=>0, “LedgerEntryType”=>“AccountRoot”, “OwnerCount”=>0, “PreviousTxnID”=>“14DBB4EBF6BE71439CE776446337A7E789EB4205D55F1731622DD225AF950BE2”, “PreviousTxnLgrSeq”=>338219, “Sequence”=>2, “index”=>“71EE27781DE11E4D3E44052E1264C9F5E01F3F2BC0F5D9A890099914C5031C91”.
- #name ⇒ Object
- #to_s ⇒ Object
Methods included from Utils
#Account, #Money, #Offer, #Time
Constructor Details
#initialize(data) ⇒ Account
String: “evoorhees” or “rpfxDFsjDNtzSBCALKuWoWMkpRp4vxvgrG” Hash:
"Balance"=>"199999990",
"Flags"=>0,
"LedgerEntryType"=>"AccountRoot",
"OwnerCount"=>0,
"PreviousTxnID"=>"14DBB4EBF6BE71439CE776446337A7E789EB4205D55F1731622DD225AF950BE2",
"PreviousTxnLgrSeq"=>338219,
"Sequence"=>2,
"index"=>"71EE27781DE11E4D3E44052E1264C9F5E01F3F2BC0F5D9A890099914C5031C91"
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rippler/account.rb', line 18 def initialize data case data when String @address = Rippler::Contacts[data] || data @name = Rippler::Addresses[@address] when Hash @address = data["Account"] @name = Rippler::Addresses[@address] @balance = Money(data["Balance"]) @flags = data["Flags"] end end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/rippler/account.rb', line 5 def address @address end |
#balance ⇒ Object
Returns the value of attribute balance.
5 6 7 |
# File 'lib/rippler/account.rb', line 5 def balance @balance end |
#flags ⇒ Object
Returns the value of attribute flags.
5 6 7 |
# File 'lib/rippler/account.rb', line 5 def flags @flags end |
Instance Method Details
#name ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rippler/account.rb', line 31 def name if @name && @name =~ /^X\.\d+/ "X.#{@address}" else @name end end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/rippler/account.rb', line 39 def to_s name || address end |