Class: Bcoin::Client::Accounts

Inherits:
Collection show all
Defined in:
lib/bcoin/client/accounts.rb

Instance Attribute Summary collapse

Attributes inherited from Collection

#collection, #error

Instance Method Summary collapse

Methods inherited from Collection

#each, #error?, #initialize, #inspect

Methods included from HttpMethods

#delete, #get, #post, #put, #wallet_token

Constructor Details

This class inherits a constructor from Bcoin::Client::Collection

Instance Attribute Details

#clientObject (readonly)

Contains an instance of Bcoin::Client::Wallet which adheres to the HTTP client interface but builds the URL correctly for the specific wallet which this account belongs to.



12
13
14
# File 'lib/bcoin/client/accounts.rb', line 12

def client
  @client
end

Instance Method Details

#base_pathObject



14
15
16
# File 'lib/bcoin/client/accounts.rb', line 14

def base_path
  '/account'
end

#find(attr) ⇒ Object



25
26
27
# File 'lib/bcoin/client/accounts.rb', line 25

def find attr
  Account.new(client, attr).refresh!
end

#refresh!Object



18
19
20
21
22
23
# File 'lib/bcoin/client/accounts.rb', line 18

def refresh!
  @collection = super.collect { |w|
    Account.new(client, name: w).refresh!
  }
  self
end