class Round::AccountCollection

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method Round::Collection::new
# File lib/round/account.rb, line 45
def initialize(options = {})
  raise ArgumentError, 'AccountCollection must be associated with a wallet' unless options[:wallet]
  @wallet = options[:wallet]
  super(options) { |account| account.wallet = @wallet }
end

Public Instance Methods

content_type() click to toggle source
# File lib/round/account.rb, line 51
def content_type
  Round::Account
end
create(name:, network:) click to toggle source
# File lib/round/account.rb, line 55
def create(name:, network:)
  unless [:bitcoin_testnet, :bitcoin, :litecoin, :dogecoin].include?(network)
    raise ArgumentError, 'Network must be :bitcoin_testnet, :dogecoin, :litecoin, :bitcoin.'
  end
  resource = @resource.create(name: name, network: network)
  account = Round::Account.new(resource: resource, wallet: @wallet, client: @client)
  add(account)
  account
end
refresh() click to toggle source
Calls superclass method Round::Collection#refresh
# File lib/round/account.rb, line 65
def refresh
  super(wallet: @wallet)
end